X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fmanipulation.js;h=88da6de527ac3eec85b274c1dd636e14e8be598a;hb=4f2e209b85b56351ed17ac0b5de60db85666209f;hp=93950de0f2472ba298e6ff401e00c8bf21ffbf7f;hpb=388a00fe918c2ec759bd33c34bfc13aabfe413d0;p=jquery.git diff --git a/src/manipulation.js b/src/manipulation.js index 93950de..88da6de 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -384,10 +384,15 @@ function cloneCopyEvent(orig, ret) { } function buildFragment( args, nodes, scripts ) { - var fragment, cacheable, cacheresults, doc; + var fragment, cacheable, cacheresults, + doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); + + // Only cache "small" (1/2 KB) strings that are associated with the main document + // Cloning options loses the selected state, so don't cache them + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache + if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && + args[0].indexOf("