diff options
author | Elijah Manor <elijah.manor@gmail.com> | 2012-08-22 21:23:50 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-08-22 21:48:02 -0400 |
commit | 10901f7d9fa6be01cc6b88cd94d279760b42a069 (patch) | |
tree | fcfc002efd7c7f13c3689c007da2290cea58b22d /src | |
parent | ae1d2b3173876e7062324aa61398fef9d0f59f79 (diff) | |
download | jquery-10901f7d9fa6be01cc6b88cd94d279760b42a069.tar.gz jquery-10901f7d9fa6be01cc6b88cd94d279760b42a069.zip |
Fix #12266. IE9/10 says document[0] is document.frames[0]? Close gh-903.
Diffstat (limited to 'src')
-rw-r--r-- | src/manipulation.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 3cfc97c3b..f87e3ca94 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -489,15 +489,11 @@ jQuery.buildFragment = function( args, context, scripts ) { first = args[ 0 ]; // 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[0] || context).ownerDocument || context[0] || context; - - // Ensure that an attr object doesn't incorrectly stand in as a document object - // Chrome and Firefox seem to allow this to occur and will throw exception - // Fixes #8950 - if ( typeof context.createDocumentFragment === "undefined" ) { - context = document; - } + 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 |