aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
authorcmcnulty <cmcnulty@kznf.com>2012-04-05 12:12:38 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-04-05 12:26:20 -0400
commit4cd57d727a075617c8db30dcf69542f66add63fe (patch)
tree8f4d286ea2d885282068178ef2e4d3a17f2e5037 /src/manipulation.js
parent36d2d9ae937f626d98319ed850905e8d1cbfd078 (diff)
downloadjquery-4cd57d727a075617c8db30dcf69542f66add63fe.tar.gz
jquery-4cd57d727a075617c8db30dcf69542f66add63fe.zip
Fix 11528. Exclude link/html5 tags from innerHTML path on oldIE.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 91502b572..7a1cc3b17 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -22,7 +22,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
- rnoInnerhtml = /<(?:script|style)/i,
+ rnoInnerhtml = /<(?:script|style|link)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rcheckableType = /^(?:checkbox|radio)$/,
@@ -46,9 +46,10 @@ wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
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 ) {
- wrapMap._default = [ 1, "div<div>", "</div>" ];
+ wrapMap._default = [ 1, "X<div>", "</div>" ];
}
jQuery.fn.extend({
@@ -220,8 +221,9 @@ jQuery.fn.extend({
null;
}
-
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {