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
b5a16ead
Commit
b5a16ead
authored
Aug 04, 2011
by
Dave Methvin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #412 from rwldrn/9587
jQuery.clone() check destination child nodes are not null. Fixes #9587
parents
59936dc0
5c3b9e0c
Changes
3
Show 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 @
b5a16ead
...
@@ -564,9 +564,12 @@ jQuery.extend({
...
@@ -564,9 +564,12 @@ 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
)
{
// Ensure that the destination node is not null; Fixes #9587
if
(
destElements
[
i
]
)
{
cloneFixAttributes
(
srcElements
[
i
],
destElements
[
i
]
);
cloneFixAttributes
(
srcElements
[
i
],
destElements
[
i
]
);
}
}
}
}
}
// Copy the events from the original to the clone
// Copy the events from the original to the clone
if
(
dataAndEvents
)
{
if
(
dataAndEvents
)
{
...
...
test/index.html
View file @
b5a16ead
...
@@ -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 @
b5a16ead
...
@@ -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