Skip to content
Permalink
Browse files
Fix #13013. Move jQuery.buildFragment() to compat plugin.
  • Loading branch information
dmethvin committed Dec 7, 2012
1 parent 747600b commit 282c044
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
@@ -493,7 +493,8 @@ jQuery.extend({
return [ context.createElement( parsed[1] ) ];
}

parsed = jQuery.buildFragment( [ data ], context, scripts );
parsed = context.createDocumentFragment();
jQuery.clean( [ data ], context, parsed, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
@@ -292,7 +292,7 @@ jQuery.fn.extend({
// Flatten any nested arrays
args = core_concat.apply( [], args );

var fragment, first, results, scripts, hasScripts, iNoClone, node, doc,
var fragment, first, scripts, hasScripts, iNoClone, node, doc,
i = 0,
l = this.length,
value = args[0],
@@ -310,8 +310,9 @@ jQuery.fn.extend({
}

if ( this[0] ) {
results = jQuery.buildFragment( args, this );
fragment = results;
doc = this[0].ownerDocument;
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment );
first = fragment.firstChild;

if ( fragment.childNodes.length === 1 ) {
@@ -512,22 +513,6 @@ function cloneFixAttributes( src, dest ) {
dest.removeAttribute( jQuery.expando );
}

jQuery.buildFragment = function( args, context, scripts ) {
var fragment;

// Set context from what may come in as undefined or a jQuery collection or a node
// Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
// also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;

fragment = context.createDocumentFragment();
jQuery.clean( args, context, fragment, scripts );

return fragment;
};

jQuery.each({
appendTo: "append",
prependTo: "prepend",

1 comment on commit 282c044

@rwaldron
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So long, suckah!

Please sign in to comment.