var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, rsingleTag = /^<(\w+)\s*\/?>$/, rxhtmlTag = /(<(\w+)[^>]*?)\/>/g, rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i, rinsideTable = /^<(thead|tbody|tfoot|colg|cap)/, rtbody = / 1 || i > 0 ? fragment.cloneNode(true) : fragment ); } } if ( scripts ) { jQuery.each( scripts, evalScript ); } if ( cacheable ) { jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; } } return this; function root( elem, cur ) { return jQuery.nodeName(elem, "table") ? (elem.getElementsByTagName("tbody")[0] || elem.appendChild(elem.ownerDocument.createElement("tbody"))) : elem; } } }); jQuery.fragments = {}; jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function(name, original){ jQuery.fn[ name ] = function( selector ) { var ret = [], insert = jQuery( selector ); for ( var i = 0, l = insert.length; i < l; i++ ) { var elems = (i > 0 ? this.clone(true) : this).get(); jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); ret = ret.concat( elems ); } return this.pushStack( ret, name, selector ); }; }); jQuery.each({ remove: function( selector ) { if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) { if ( this.nodeType === 1 ) { cleanData( jQuery("*", this).add(this) ); } if ( this.parentNode ) { this.parentNode.removeChild( this ); } } }, empty: function() { // Remove element nodes and prevent memory leaks if ( this.nodeType === 1 ) { cleanData( jQuery("*", this) ); } // Remove any remaining nodes while ( this.firstChild ) { this.removeChild( this.firstChild ); } } }, function(name, fn){ jQuery.fn[ name ] = function(){ return this.each( fn, arguments ); }; }); jQuery.extend({ clean: function( elems, context, fragment ) { context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' if ( typeof context.createElement === "undefined" ) { context = context.ownerDocument || context[0] && context[0].ownerDocument || document; } // If a single string is passed in and it's a single tag // just do a createElement and skip the rest if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { var match = rsingleTag.exec(elems[0]); if ( match ) { return [ context.createElement( match[1] ) ]; } } var ret = [], scripts = [], div = context.createElement("div"); jQuery.each(elems, function(i, elem){ if ( typeof elem === "number" ) { elem += ''; } if ( !elem ) { return; } // Convert html string into DOM nodes if ( typeof elem === "string" ) { // Fix "XHTML"-style tags in all browsers elem = elem.replace(rxhtmlTag, function(all, front, tag){ return rselfClosing.test(tag) ? all : front + ">"; }); // Trim whitespace, otherwise indexOf won't work as expected var tags = elem.replace(rleadingWhitespace, "") .substring(0, 10).toLowerCase(); var wrap = // option or optgroup !tags.indexOf("", "" ] || !tags.indexOf("", "" ] || rinsideTable.test(tags) && [ 1, "", "
" ] || !tags.indexOf("", "" ] || // matched above (!tags.indexOf("", "" ] || !tags.indexOf("", "" ] || // IE can't serialize and