Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
c1b8edfc
Commit
c1b8edfc
authored
Apr 17, 2013
by
Rick Waldron
Committed by
Dave Methvin
May 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize cleanData: allow direct access to data_priv for cleanup
parent
5e8a5f4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 deletions
+25
-23
data.js
src/data.js
+3
-1
manipulation.js
src/manipulation.js
+22
-22
No files found.
src/data.js
View file @
c1b8edfc
...
@@ -185,7 +185,9 @@ Data.prototype = {
...
@@ -185,7 +185,9 @@ Data.prototype = {
);
);
},
},
discard
:
function
(
owner
)
{
discard
:
function
(
owner
)
{
delete
this
.
cache
[
this
.
key
(
owner
)
];
if
(
owner
[
this
.
expando
]
)
{
delete
this
.
cache
[
owner
[
this
.
expando
]
];
}
}
}
};
};
...
...
src/manipulation.js
View file @
c1b8edfc
...
@@ -433,35 +433,35 @@ jQuery.extend({
...
@@ -433,35 +433,35 @@ jQuery.extend({
},
},
cleanData
:
function
(
elems
)
{
cleanData
:
function
(
elems
)
{
var
data
,
elem
,
type
,
var
data
,
elem
,
events
,
type
,
key
,
j
,
l
=
elems
.
length
,
special
=
jQuery
.
event
.
special
,
i
=
0
,
i
=
0
;
special
=
jQuery
.
event
.
special
;
for
(
;
i
<
l
;
i
++
)
{
elem
=
elems
[
i
];
if
(
jQuery
.
acceptData
(
elem
)
)
{
data
=
data_priv
.
access
(
elem
);
for
(
;
(
elem
=
elems
[
i
])
!==
undefined
;
i
++
)
{
if
(
Data
.
accepts
(
elem
)
)
{
key
=
elem
[
data_priv
.
expando
];
if
(
data
)
{
if
(
key
&&
(
data
=
data_priv
.
cache
[
key
])
)
{
for
(
type
in
data
.
events
)
{
events
=
Object
.
keys
(
data
.
events
||
{}
);
if
(
special
[
type
]
)
{
if
(
events
.
length
)
{
jQuery
.
event
.
remove
(
elem
,
type
);
for
(
j
=
0
;
(
type
=
events
[
j
])
!==
undefined
;
j
++
)
{
if
(
special
[
type
]
)
{
jQuery
.
event
.
remove
(
elem
,
type
);
// This is a shortcut to avoid jQuery.event.remove's overhead
// This is a shortcut to avoid jQuery.event.remove's overhead
}
else
{
}
else
{
jQuery
.
removeEvent
(
elem
,
type
,
data
.
handle
);
jQuery
.
removeEvent
(
elem
,
type
,
data
.
handle
);
}
}
}
}
}
if
(
data_priv
.
cache
[
key
]
)
{
// Discard any remaining `private` data
delete
data_priv
.
cache
[
key
];
}
}
}
}
}
// Discard any remaining `private` and `user` data
// Discard any remaining `user` data
// One day we'll replace the dual arrays with a WeakMap and this won't be an issue.
delete
data_user
.
cache
[
elem
[
data_user
.
expando
]
];
// (Splices the data objects out of the internal cache arrays)
data_user
.
discard
(
elem
);
data_priv
.
discard
(
elem
);
}
}
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment