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
4cd57d72
Commit
4cd57d72
authored
Apr 05, 2012
by
cmcnulty
Committed by
Dave Methvin
Apr 05, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 11528. Exclude link/html5 tags from innerHTML path on oldIE.
parent
36d2d9ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
manipulation.js
src/manipulation.js
+7
-5
manipulation.js
test/unit/manipulation.js
+13
-0
No files found.
src/manipulation.js
View file @
4cd57d72
...
@@ -22,7 +22,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
...
@@ -22,7 +22,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
rtagName
=
/<
([\w
:
]
+
)
/
,
rtagName
=
/<
([\w
:
]
+
)
/
,
rtbody
=
/<tbody/i
,
rtbody
=
/<tbody/i
,
rhtml
=
/<|&#
?\w
+;/
,
rhtml
=
/<|&#
?\w
+;/
,
rnoInnerhtml
=
/<
(?:
script|style
)
/i
,
rnoInnerhtml
=
/<
(?:
script|style
|link
)
/i
,
rnocache
=
/<
(?:
script|object|embed|option|style
)
/i
,
rnocache
=
/<
(?:
script|object|embed|option|style
)
/i
,
rnoshimcache
=
new
RegExp
(
"<(?:"
+
nodeNames
+
")[
\\
s/>]"
,
"i"
),
rnoshimcache
=
new
RegExp
(
"<(?:"
+
nodeNames
+
")[
\\
s/>]"
,
"i"
),
rcheckableType
=
/^
(?:
checkbox|radio
)
$/
,
rcheckableType
=
/^
(?:
checkbox|radio
)
$/
,
...
@@ -46,9 +46,10 @@ wrapMap.optgroup = wrapMap.option;
...
@@ -46,9 +46,10 @@ wrapMap.optgroup = wrapMap.option;
wrapMap
.
tbody
=
wrapMap
.
tfoot
=
wrapMap
.
colgroup
=
wrapMap
.
caption
=
wrapMap
.
thead
;
wrapMap
.
tbody
=
wrapMap
.
tfoot
=
wrapMap
.
colgroup
=
wrapMap
.
caption
=
wrapMap
.
thead
;
wrapMap
.
th
=
wrapMap
.
td
;
wrapMap
.
th
=
wrapMap
.
td
;
// IE can't serialize <link> and <script> tags normally
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
if
(
!
jQuery
.
support
.
htmlSerialize
)
{
if
(
!
jQuery
.
support
.
htmlSerialize
)
{
wrapMap
.
_default
=
[
1
,
"
div
<div>"
,
"</div>"
];
wrapMap
.
_default
=
[
1
,
"
X
<div>"
,
"</div>"
];
}
}
jQuery
.
fn
.
extend
({
jQuery
.
fn
.
extend
({
...
@@ -220,8 +221,9 @@ jQuery.fn.extend({
...
@@ -220,8 +221,9 @@ jQuery.fn.extend({
null
;
null
;
}
}
// See if we can take a shortcut and just use innerHTML
if
(
typeof
value
===
"string"
&&
!
rnoInnerhtml
.
test
(
value
)
&&
if
(
typeof
value
===
"string"
&&
!
rnoInnerhtml
.
test
(
value
)
&&
(
jQuery
.
support
.
htmlSerialize
||
!
rnoshimcache
.
test
(
value
)
)
&&
(
jQuery
.
support
.
leadingWhitespace
||
!
rleadingWhitespace
.
test
(
value
)
)
&&
(
jQuery
.
support
.
leadingWhitespace
||
!
rleadingWhitespace
.
test
(
value
)
)
&&
!
wrapMap
[
(
rtagName
.
exec
(
value
)
||
[
""
,
""
]
)[
1
].
toLowerCase
()
]
)
{
!
wrapMap
[
(
rtagName
.
exec
(
value
)
||
[
""
,
""
]
)[
1
].
toLowerCase
()
]
)
{
...
...
test/unit/manipulation.js
View file @
4cd57d72
...
@@ -555,6 +555,19 @@ test("html(String) with HTML5 (Bug #6485)", function() {
...
@@ -555,6 +555,19 @@ test("html(String) with HTML5 (Bug #6485)", function() {
equal
(
jQuery
(
"#qunit-fixture"
).
children
().
children
().
children
().
length
,
1
,
"Make sure nested HTML5 elements can hold children."
);
equal
(
jQuery
(
"#qunit-fixture"
).
children
().
children
().
children
().
length
,
1
,
"Make sure nested HTML5 elements can hold children."
);
});
});
test
(
"IE8 serialization bug"
,
function
()
{
expect
(
2
);
var
wrapper
=
jQuery
(
"<div></div>"
);
wrapper
.
html
(
"<div></div><article></article>"
);
equal
(
wrapper
.
children
(
"article"
).
length
,
1
,
"HTML5 elements are insertable with .html()"
);
wrapper
.
html
(
"<div></div><link></link>"
);
equal
(
wrapper
.
children
(
"link"
).
length
,
1
,
"Link elements are insertable with .html()"
);
});
test
(
"append(xml)"
,
function
()
{
test
(
"append(xml)"
,
function
()
{
expect
(
1
);
expect
(
1
);
...
...
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