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
279f77e9
Commit
279f77e9
authored
Dec 12, 2007
by
David Serduke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in clone where it wouldn't work on an XML node in IE. Also added unit test for it.
parent
c6a44c79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+11
-1
No files found.
src/core.js
View file @
279f77e9
...
@@ -290,7 +290,7 @@ jQuery.fn = jQuery.prototype = {
...
@@ -290,7 +290,7 @@ jQuery.fn = jQuery.prototype = {
clone
:
function
(
events
)
{
clone
:
function
(
events
)
{
// Do the clone
// Do the clone
var
ret
=
this
.
map
(
function
(){
var
ret
=
this
.
map
(
function
(){
if
(
jQuery
.
browser
.
msie
)
{
if
(
jQuery
.
browser
.
msie
&&
!
jQuery
.
isXMLDoc
(
this
)
)
{
// IE copies events bound via attachEvent when
// IE copies events bound via attachEvent when
// using cloneNode. Calling detachEvent on the
// using cloneNode. Calling detachEvent on the
// clone will also remove the events from the orignal
// clone will also remove the events from the orignal
...
...
test/unit/core.js
View file @
279f77e9
...
@@ -864,7 +864,7 @@ test("find(String)", function() {
...
@@ -864,7 +864,7 @@ test("find(String)", function() {
});
});
test
(
"clone()"
,
function
()
{
test
(
"clone()"
,
function
()
{
expect
(
4
);
expect
(
6
);
ok
(
'This is a normal link: Yahoo'
==
$
(
'#en'
).
text
(),
'Assert text for #en'
);
ok
(
'This is a normal link: Yahoo'
==
$
(
'#en'
).
text
(),
'Assert text for #en'
);
var
clone
=
$
(
'#yahoo'
).
clone
();
var
clone
=
$
(
'#yahoo'
).
clone
();
ok
(
'Try them out:Yahoo'
==
$
(
'#first'
).
append
(
clone
).
text
(),
'Check for clone'
);
ok
(
'Try them out:Yahoo'
==
$
(
'#first'
).
append
(
clone
).
text
(),
'Check for clone'
);
...
@@ -872,6 +872,16 @@ test("clone()", function() {
...
@@ -872,6 +872,16 @@ test("clone()", function() {
// using contents will get comments regular, text, and comment nodes
// using contents will get comments regular, text, and comment nodes
var
cl
=
$
(
"#nonnodes"
).
contents
().
clone
();
var
cl
=
$
(
"#nonnodes"
).
contents
().
clone
();
ok
(
cl
.
length
>=
2
,
"Check node,textnode,comment clone works (some browsers delete comments on clone)"
);
ok
(
cl
.
length
>=
2
,
"Check node,textnode,comment clone works (some browsers delete comments on clone)"
);
stop
();
$
.
get
(
"data/dashboard.xml"
,
function
(
xml
)
{
var
root
=
$
(
xml
.
documentElement
).
clone
();
$
(
"tab:first"
,
xml
).
text
(
"origval"
);
$
(
"tab:first"
,
root
).
text
(
"cloneval"
);
equals
(
$
(
"tab:first"
,
xml
).
text
(),
"origval"
,
"Check original XML node was correctly set"
);
equals
(
$
(
"tab:first"
,
root
).
text
(),
"cloneval"
,
"Check cloned XML node was correctly set"
);
start
();
});
});
});
test
(
"is(String)"
,
function
()
{
test
(
"is(String)"
,
function
()
{
...
...
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