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
5c3b9e0c
Commit
5c3b9e0c
authored
Jun 15, 2011
by
rwldrn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jQuery.clone() check that destination child nodes are not null. Fixes #9587
parent
d59b0f3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
manipulation.js
src/manipulation.js
+5
-2
index.html
test/index.html
+2
-0
manipulation.js
test/unit/manipulation.js
+11
-0
No files found.
src/manipulation.js
View file @
5c3b9e0c
...
@@ -564,7 +564,10 @@ jQuery.extend({
...
@@ -564,7 +564,10 @@ jQuery.extend({
// with an element if you are cloning the body and one of the
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
// elements on the page has a name or id of "length"
for
(
i
=
0
;
srcElements
[
i
];
++
i
)
{
for
(
i
=
0
;
srcElements
[
i
];
++
i
)
{
cloneFixAttributes
(
srcElements
[
i
],
destElements
[
i
]
);
// Ensure that the destination node is not null; Fixes #9587
if
(
destElements
[
i
]
)
{
cloneFixAttributes
(
srcElements
[
i
],
destElements
[
i
]
);
}
}
}
}
}
...
@@ -762,4 +765,4 @@ function evalScript( i, elem ) {
...
@@ -762,4 +765,4 @@ function evalScript( i, elem ) {
}
}
}
}
})(
jQuery
);
})(
jQuery
);
\ No newline at end of file
test/index.html
View file @
5c3b9e0c
...
@@ -281,6 +281,8 @@ Z</textarea>
...
@@ -281,6 +281,8 @@ Z</textarea>
</div>
</div>
<div
id=
"fx-tests"
></div>
<div
id=
"fx-tests"
></div>
<div
id=
"no-clone-exception"
><object><embed></embed></object></div>
</div>
</div>
</body>
</body>
</html>
</html>
test/unit/manipulation.js
View file @
5c3b9e0c
...
@@ -1465,3 +1465,14 @@ test("jQuery.buildFragment - plain objects are not a document #8950", function()
...
@@ -1465,3 +1465,14 @@ test("jQuery.buildFragment - plain objects are not a document #8950", function()
}
catch
(
e
)
{}
}
catch
(
e
)
{}
});
});
test
(
"jQuery.clone - no exceptions for object elements #9587"
,
function
()
{
expect
(
1
);
try
{
jQuery
(
"#no-clone-exception"
).
clone
();
ok
(
true
,
"cloned with no exceptions"
);
}
catch
(
e
)
{
ok
(
false
,
e
.
message
);
}
});
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