-function createSafeFragment( document ) {
- var list = nodeNames.split( "|" ),
- safeFrag = document.createDocumentFragment();
-
- if ( safeFrag.createElement ) {
- while ( list.length ) {
- safeFrag.createElement(
- list.pop()
- );
- }
- }
- return safeFrag;
-}
-
-var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
- "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
- rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
- rleadingWhitespace = /^\s+/,
+var rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
tr: [ 2, "<table><tbody>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</table>" ],
td: [ 3, "<table><tbody><tr>" ],
-
- // 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") );
+ _default: [ 0, "" ]
+ };
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
l = this.length;
if ( value === undefined ) {
- return elem.nodeType === 1 ?
- elem.innerHTML.replace( rinlinejQuery, "" ) :
- undefined;
+ return elem.nodeType === 1 ? elem.innerHTML: undefined;
}
// 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() ] ) {
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var destElements, srcElements, node, i, clone,
- inPage = jQuery.contains( elem.ownerDocument, elem );
-
- if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ var destElements, srcElements, node, i,
+ inPage = jQuery.contains( elem.ownerDocument, elem ),
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
- } else {
- fragmentDiv.innerHTML = elem.outerHTML;
- fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
- }
-
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
clean: function( elems, context, fragment, scripts, selection ) {
var elem, i, j, tmp, tag, wrap, tbody,
ret = [],
- safe = context === document && safeFragment;
+ container = context === document && fragment;
// Ensure that context is a document
if ( !context || typeof context.createDocumentFragment === "undefined" ) {
// Convert html into DOM nodes
} else {
// Ensure a safe container
- safe = safe || createSafeFragment( context );
- tmp = tmp || safe.appendChild( context.createElement("div") );
+ container = container || context.createDocumentFragment();
+ tmp = tmp || container.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
}
// Remember the top-level container for proper cleanup
- tmp = safe.lastChild;
+ tmp = container.lastChild;
}
}
}
- // Fix #11356: Clear elements from safeFragment
+ // Fix #11356: Clear elements from fragment
if ( tmp ) {
- safe.removeChild( tmp );
+ container.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
if ( fragment ) {
for ( i = 0; (elem = ret[i]) != null; i++ ) {
- safe = jQuery.contains( elem.ownerDocument, elem );
+ container = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
// #4087 - If origin and destination elements are the same, and this is
tmp = getAll( elem, "script" );
// Preserve script evaluation history
- if ( safe ) {
+ if ( container ) {
setGlobalEval( tmp );
}
}
}
- elem = tmp = safe = null;
-
return ret;
},
// Setup
div.setAttribute( "className", "t" );
- div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+ div.innerHTML = " <table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
-
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
- // Makes sure cloning an html5 element does not cause problems
- // Where outerHTML is undefined, this still works
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
-
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: document.compatMode === "CSS1Compat",