aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-17 14:17:05 -0500
committerjeresig <jeresig@gmail.com>2009-12-17 14:17:05 -0500
commited5731dcc41db31fd699d1f4e4b250e83b10308e (patch)
tree91a1372d4ea8b7f64e5817bd3fa3cc58fd26bbdc /src
parentba86cc0294e483752fd76f620aba6d0a4a7a8ee1 (diff)
downloadjquery-ed5731dcc41db31fd699d1f4e4b250e83b10308e.tar.gz
jquery-ed5731dcc41db31fd699d1f4e4b250e83b10308e.zip
Revert the changes from 65ebf57c1e5d7fa96536b66d4fcacbafad8dc1e5, they were ineffectual against IE's insanity: http://ejohn.org/files/bugs/fragment/ Used a different tactic instead (just don't return a fragment from .parent()). Fixes #5638.
Diffstat (limited to 'src')
-rw-r--r--src/core.js9
-rw-r--r--src/traversing.js2
2 files changed, 3 insertions, 8 deletions
diff --git a/src/core.js b/src/core.js
index 8f81c520e..1edf98edc 100644
--- a/src/core.js
+++ b/src/core.js
@@ -53,7 +53,7 @@ var jQuery = function( selector, context ) {
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
- var match, elem, ret, doc, parent;
+ var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
@@ -88,12 +88,7 @@ jQuery.fn = jQuery.prototype = {
} else {
ret = buildFragment( [ match[1] ], [ doc ] );
- parent = ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment;
- selector = [];
-
- while ( parent.firstChild ) {
- selector.push( parent.removeChild( parent.firstChild ) );
- }
+ selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
}
// HANDLE: $("#id")
diff --git a/src/traversing.js b/src/traversing.js
index 6375d9d1f..d30e4e6da 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -161,7 +161,7 @@ jQuery.fn.extend({
});
jQuery.each({
- parent: function(elem){return elem.parentNode;},
+ parent: function(elem){var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null;},
parents: function(elem){return jQuery.dir(elem,"parentNode");},
parentsUntil: function(elem,i,until){return jQuery.dir(elem,"parentNode",until);},
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},