aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Ramos <paul.b.ramos@gmail.com>2012-12-04 21:30:37 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-12-04 21:30:37 -0500
commit13449a99b2b279a7ae6401b8373d20504362213d (patch)
tree0e0687f7fe3237e463b56a67e5b8aec620e3c007 /src
parentec72d9f4db9ede84f4c1fb3d4e0e29083dd07095 (diff)
downloadjquery-13449a99b2b279a7ae6401b8373d20504362213d.tar.gz
jquery-13449a99b2b279a7ae6401b8373d20504362213d.zip
Fix #11989. Remove fragment cache, moving to jquery-compat. Close gh-1052.
Diffstat (limited to 'src')
-rw-r--r--src/core.js3
-rw-r--r--src/manipulation.js43
2 files changed, 9 insertions, 37 deletions
diff --git a/src/core.js b/src/core.js
index eee810070..22b56ce5d 100644
--- a/src/core.js
+++ b/src/core.js
@@ -497,8 +497,7 @@ jQuery.extend({
if ( scripts ) {
jQuery( scripts ).remove();
}
- return jQuery.merge( [],
- ( parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment ).childNodes );
+ return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
diff --git a/src/manipulation.js b/src/manipulation.js
index f215d5a8c..6cde99404 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -22,7 +22,6 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
- rnocache = /<(?:script|style|object|embed|applet|option)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
@@ -315,7 +314,7 @@ jQuery.fn.extend({
if ( this[0] ) {
results = jQuery.buildFragment( args, this );
- fragment = results.fragment;
+ fragment = results;
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
@@ -329,9 +328,9 @@ jQuery.fn.extend({
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
- // Fragments from the fragment cache must always be cloned and never used in place.
- for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
+ for ( iNoClone = l - 1; i < l; i++ ) {
node = fragment;
+
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
@@ -340,6 +339,7 @@ jQuery.fn.extend({
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
+
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
@@ -515,8 +515,7 @@ function cloneFixAttributes( src, dest ) {
}
jQuery.buildFragment = function( args, context, scripts ) {
- var fragment, cacheable, cachehit,
- first = args[ 0 ];
+ 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 &
@@ -525,38 +524,12 @@ jQuery.buildFragment = function( args, context, scripts ) {
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
- // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
- // Cloning options loses the selected state, so don't cache them
- // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
- // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
- // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
- if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
- first.charAt(0) === "<" && !rnocache.test( first ) &&
- (jQuery.support.checkClone || !rchecked.test( first )) &&
- (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
-
- // Mark cacheable and look for a hit
- cacheable = true;
- fragment = jQuery.fragments[ first ];
- cachehit = fragment !== undefined;
- }
-
- if ( !fragment ) {
- fragment = context.createDocumentFragment();
- jQuery.clean( args, context, fragment, scripts );
+ fragment = context.createDocumentFragment();
+ jQuery.clean( args, context, fragment, scripts );
- // Update the cache, but only store false
- // unless this is a second parsing of the same content
- if ( cacheable ) {
- jQuery.fragments[ first ] = cachehit && fragment;
- }
- }
-
- return { fragment: fragment, cacheable: cacheable };
+ return fragment;
};
-jQuery.fragments = {};
-
jQuery.each({
appendTo: "append",
prependTo: "prepend",