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
87a7690a
Commit
87a7690a
authored
Dec 23, 2012
by
Oleg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use correct comments
parent
9256ba53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
manipulation.js
src/manipulation.js
+11
-8
No files found.
src/manipulation.js
View file @
87a7690a
...
@@ -377,14 +377,15 @@ jQuery.extend({
...
@@ -377,14 +377,15 @@ jQuery.extend({
inPage
=
jQuery
.
contains
(
elem
.
ownerDocument
,
elem
),
inPage
=
jQuery
.
contains
(
elem
.
ownerDocument
,
elem
),
clone
=
elem
.
cloneNode
(
true
);
clone
=
elem
.
cloneNode
(
true
);
// Fix IE cloning issues
// Support: IE >=9
// Fix Cloning issues
if
(
!
jQuery
.
support
.
noCloneChecked
&&
(
elem
.
nodeType
===
1
||
elem
.
nodeType
===
11
)
&&
!
jQuery
.
isXMLDoc
(
elem
)
)
{
if
(
!
jQuery
.
support
.
noCloneChecked
&&
(
elem
.
nodeType
===
1
||
elem
.
nodeType
===
11
)
&&
!
jQuery
.
isXMLDoc
(
elem
)
)
{
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements
=
getAll
(
clone
);
destElements
=
getAll
(
clone
);
srcElements
=
getAll
(
elem
);
srcElements
=
getAll
(
elem
);
for
(
i
=
0
;
(
node
=
srcElements
[
i
]
)
!=
null
;
++
i
)
{
for
(
i
=
0
;
(
node
=
srcElements
[
i
]
)
!=
null
;
++
i
)
{
// Ensure that the destination node is not null; Fixes #9587
// Ensure that the destination node is not null; Fixes #9587
if
(
destElements
[
i
]
)
{
if
(
destElements
[
i
]
)
{
fixCloneNodeIssues
(
node
,
destElements
[
i
]
);
fixCloneNodeIssues
(
node
,
destElements
[
i
]
);
...
@@ -438,6 +439,7 @@ jQuery.extend({
...
@@ -438,6 +439,7 @@ jQuery.extend({
// Convert html into DOM nodes
// Convert html into DOM nodes
}
else
{
}
else
{
// Ensure a safe container
// Ensure a safe container
container
=
container
||
context
.
createDocumentFragment
();
container
=
container
||
context
.
createDocumentFragment
();
tmp
=
tmp
||
container
.
appendChild
(
context
.
createElement
(
"div"
)
);
tmp
=
tmp
||
container
.
appendChild
(
context
.
createElement
(
"div"
)
);
...
@@ -455,7 +457,7 @@ jQuery.extend({
...
@@ -455,7 +457,7 @@ jQuery.extend({
core_push
.
apply
(
ret
,
tmp
.
childNodes
);
core_push
.
apply
(
ret
,
tmp
.
childNodes
);
// Fix #12392
for WebKit and IE > 9
// Fix #12392
- remove childNodes parent
tmp
.
textContent
=
""
;
tmp
.
textContent
=
""
;
// Remember the top-level container for proper cleanup
// Remember the top-level container for proper cleanup
...
@@ -630,20 +632,21 @@ function fixCloneNodeIssues( src, dest ) {
...
@@ -630,20 +632,21 @@ function fixCloneNodeIssues( src, dest ) {
dest
.
outerHTML
=
src
.
outerHTML
;
dest
.
outerHTML
=
src
.
outerHTML
;
}
}
//
This path appears unavoidable for IE9. When cloning an object
//
Support: IE 9
//
element in IE9,
the outerHTML strategy above is not sufficient.
//
When cloning an object
the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
// copy the src.innerHTML into the dest.innerHTML. #10324
if
(
src
.
innerHTML
&&
!
jQuery
.
trim
(
dest
.
innerHTML
)
)
{
if
(
src
.
innerHTML
&&
!
jQuery
.
trim
(
dest
.
innerHTML
)
)
{
dest
.
innerHTML
=
src
.
innerHTML
;
dest
.
innerHTML
=
src
.
innerHTML
;
}
}
// IE9-10 fails to persist the checked state of a cloned checkbox or radio button.
// Support: IE >= 9
// Fails to persist the checked state of a cloned checkbox or radio button.
}
else
if
(
nodeName
===
"input"
&&
manipulation_rcheckableType
.
test
(
src
.
type
)
)
{
}
else
if
(
nodeName
===
"input"
&&
manipulation_rcheckableType
.
test
(
src
.
type
)
)
{
dest
.
checked
=
src
.
checked
;
dest
.
checked
=
src
.
checked
;
//
IE9-10 fails to return the selected option to the default selected
//
Support: IE >= 9
// state when cloning options
//
Fails to return the selected option to the default selected
state when cloning options
}
else
if
(
nodeName
===
"input"
||
nodeName
===
"textarea"
)
{
}
else
if
(
nodeName
===
"input"
||
nodeName
===
"textarea"
)
{
dest
.
defaultValue
=
src
.
defaultValue
;
dest
.
defaultValue
=
src
.
defaultValue
;
}
}
...
...
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