aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2012-11-20 22:57:41 -0500
committerRichard Gibson <richard.gibson@gmail.com>2012-11-20 22:57:41 -0500
commitbb570fc37341520c27a76190e0c11271596890ec (patch)
tree25df9a9186b66ac55bb88fb798cc895fdb2f4289 /src/manipulation.js
parent22f58bd688e35a473e6088bc47c1ba23ebcb0cdc (diff)
downloadjquery-bb570fc37341520c27a76190e0c11271596890ec.tar.gz
jquery-bb570fc37341520c27a76190e0c11271596890ec.zip
Fix #12920: remove addMandatoryAttributes. Close gh-1037.
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js38
1 files changed, 9 insertions, 29 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index c1097b20c..b179dab2e 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -32,44 +32,24 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
+ area: [ 1, "<map>", "</map>" ],
+ param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
- area: [ 1, "<map>", "</map>" ],
- _default: [ 0, "", "" ]
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+ // 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.
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "" ]
},
safeFragment = createSafeFragment( document ),
- fragmentDiv = safeFragment.appendChild( document.createElement("div") ),
- addMandatoryAttributes = function( elem ) { return elem; };
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
-// 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, "X<div>", "" ];
- // Fixes #11280
- wrapMap.param = [ 1, "X<object>", "" ];
- // Fixes #11280. HTMLParam name attribute added to avoid IE6-8 parsing issue.
- addMandatoryAttributes = function( elem ) {
- // If it's a param
- return elem.replace(/<param([^>]*)>/gi, function( m, s1, offset ) {
- var name = s1.match( /name=["']([^"']*)["']/i );
- return name ?
- ( name[1].length ?
- // It has a name attr with a value
- "<param" + s1 + ">" :
- // It has name attr without a value
- "<param" + s1.replace( name[0], "name='_" + offset + "'" ) + ">" ) :
- // No name attr
- "<param name='_" + offset + "' " + s1 + ">";
- });
- };
-}
-
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
@@ -733,7 +713,7 @@ jQuery.extend({
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
- tmp.innerHTML = wrap[1] + addMandatoryAttributes( elem.replace( rxhtmlTag, "<$1></$2>" ) ) + wrap[2];
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];