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
ab2a70e6
Commit
ab2a70e6
authored
Nov 21, 2010
by
Anton M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure IE clones body elements correctly. Fixes 4386.
parent
0838bdf5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
manipulation.js
src/manipulation.js
+4
-1
manipulation.js
test/unit/manipulation.js
+3
-1
No files found.
src/manipulation.js
View file @
ab2a70e6
...
@@ -10,6 +10,8 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
...
@@ -10,6 +10,8 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
// checked="checked" or checked (html5)
// checked="checked" or checked (html5)
rchecked
=
/checked
\s
*
(?:[^
=
]
|=
\s
*.checked.
)
/i
,
rchecked
=
/checked
\s
*
(?:[^
=
]
|=
\s
*.checked.
)
/i
,
raction
=
/
\=([^
="'>
\s]
+
\/)
>/g
,
raction
=
/
\=([^
="'>
\s]
+
\/)
>/g
,
rbodystart
=
/^
\s
*<body/i
,
rbodyend
=
/<
\/
body>
\s
*$/i
,
wrapMap
=
{
wrapMap
=
{
option
:
[
1
,
"<select multiple='multiple'>"
,
"</select>"
],
option
:
[
1
,
"<select multiple='multiple'>"
,
"</select>"
],
legend
:
[
1
,
"<fieldset>"
,
"</fieldset>"
],
legend
:
[
1
,
"<fieldset>"
,
"</fieldset>"
],
...
@@ -198,11 +200,12 @@ jQuery.fn.extend({
...
@@ -198,11 +200,12 @@ jQuery.fn.extend({
// the name attribute on an input).
// the name attribute on an input).
var
html
=
this
.
outerHTML
,
var
html
=
this
.
outerHTML
,
ownerDocument
=
this
.
ownerDocument
;
ownerDocument
=
this
.
ownerDocument
;
if
(
!
html
)
{
if
(
!
html
)
{
var
div
=
ownerDocument
.
createElement
(
"div"
);
var
div
=
ownerDocument
.
createElement
(
"div"
);
div
.
appendChild
(
this
.
cloneNode
(
true
)
);
div
.
appendChild
(
this
.
cloneNode
(
true
)
);
html
=
div
.
innerHTML
;
html
=
div
.
innerHTML
;
}
else
if
(
rbodystart
.
test
(
html
)
&&
rbodyend
.
test
(
html
)
)
{
html
=
html
.
replace
(
rbodystart
,
"<div>"
).
replace
(
rbodyend
,
"</div>"
);
}
}
return
jQuery
.
clean
([
html
.
replace
(
rinlinejQuery
,
""
)
return
jQuery
.
clean
([
html
.
replace
(
rinlinejQuery
,
""
)
...
...
test/unit/manipulation.js
View file @
ab2a70e6
...
@@ -814,7 +814,7 @@ test("replaceAll(String|Element|Array<Element>|jQuery)", function() {
...
@@ -814,7 +814,7 @@ test("replaceAll(String|Element|Array<Element>|jQuery)", function() {
});
});
test
(
"clone()"
,
function
()
{
test
(
"clone()"
,
function
()
{
expect
(
3
1
);
expect
(
3
2
);
equals
(
'This is a normal link: Yahoo'
,
jQuery
(
'#en'
).
text
(),
'Assert text for #en'
);
equals
(
'This is a normal link: Yahoo'
,
jQuery
(
'#en'
).
text
(),
'Assert text for #en'
);
var
clone
=
jQuery
(
'#yahoo'
).
clone
();
var
clone
=
jQuery
(
'#yahoo'
).
clone
();
equals
(
'Try them out:Yahoo'
,
jQuery
(
'#first'
).
append
(
clone
).
text
(),
'Check for clone'
);
equals
(
'Try them out:Yahoo'
,
jQuery
(
'#first'
).
append
(
clone
).
text
(),
'Check for clone'
);
...
@@ -872,6 +872,8 @@ test("clone()", function() {
...
@@ -872,6 +872,8 @@ test("clone()", function() {
form
.
appendChild
(
div
);
form
.
appendChild
(
div
);
equals
(
jQuery
(
form
).
clone
().
children
().
length
,
1
,
"Make sure we just get the form back."
);
equals
(
jQuery
(
form
).
clone
().
children
().
length
,
1
,
"Make sure we just get the form back."
);
equal
(
jQuery
(
"body"
).
clone
().
children
()[
0
].
id
,
"qunit-header"
,
"Make sure cloning body works"
);
});
});
if
(
!
isLocal
)
{
if
(
!
isLocal
)
{
...
...
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