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
619f0d90
Commit
619f0d90
authored
Mar 06, 2012
by
Rick Waldron waldron.rick@gmail.com
Committed by
Dave Methvin
Mar 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Guard against exceptions when clearing safeChildNodes.
Supplements #11356 and fixes unit test failures in FF 3.6.
parent
e529d91c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
manipulation.js
src/manipulation.js
+7
-3
manipulation.js
test/unit/manipulation.js
+12
-0
No files found.
src/manipulation.js
View file @
619f0d90
...
@@ -727,10 +727,14 @@ jQuery.extend({
...
@@ -727,10 +727,14 @@ jQuery.extend({
// to avoid hoarding elements. Fixes #11356
// to avoid hoarding elements. Fixes #11356
if
(
div
)
{
if
(
div
)
{
div
.
parentNode
.
removeChild
(
div
);
div
.
parentNode
.
removeChild
(
div
);
remove
=
safeChildNodes
[
safeChildNodes
.
length
-
1
];
if
(
remove
&&
remove
.
parentNode
)
{
// Guard against -1 index exceptions in FF3.6
remove
.
parentNode
.
removeChild
(
remove
);
if
(
safeChildNodes
.
length
>
0
)
{
remove
=
safeChildNodes
[
safeChildNodes
.
length
-
1
];
if
(
remove
&&
remove
.
parentNode
)
{
remove
.
parentNode
.
removeChild
(
remove
);
}
}
}
}
}
}
}
...
...
test/unit/manipulation.js
View file @
619f0d90
...
@@ -1740,3 +1740,15 @@ test("jQuery.fragments cache expectations", function() {
...
@@ -1740,3 +1740,15 @@ test("jQuery.fragments cache expectations", function() {
equal
(
fragmentCacheSize
(),
12
,
"12 entries exist in jQuery.fragments, 2"
);
equal
(
fragmentCacheSize
(),
12
,
"12 entries exist in jQuery.fragments, 2"
);
});
});
test
(
"Guard against exceptions when clearing safeChildNodes"
,
function
()
{
expect
(
1
);
var
div
;
try
{
div
=
jQuery
(
"<div/><hr/><code/><b/>"
);
}
catch
(
e
)
{}
ok
(
div
&&
div
.
jquery
,
"Created nodes safely, guarded against exceptions on safeChildNodes[ -1 ]"
);
});
\ No newline at end of file
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