X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=dca186744cd58d79818b63aab2a5f44bdd846be6;hb=87284a8ee751e1b4bb4a1ed96cdb92cb938d5f04;hp=ac263bcedff45b0fc35822e2437c8ed37d8a37ff;hpb=43d3deb7c81fb4bd35a7f98c5f01f5f653b4c5a2;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index ac263bc..dca1867 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1916,15 +1916,17 @@ jQuery.extend({ */ sibling: function(elem, pos, not) { var elems = []; - - var siblings = elem.parentNode.childNodes; - for ( var i = 0; i < siblings.length; i++ ) { - if ( not === true && siblings[i] == elem ) continue; - - if ( siblings[i].nodeType == 1 ) - elems.push( siblings[i] ); - if ( siblings[i] == elem ) - elems.n = elems.length - 1; + + if(elem) { + var siblings = elem.parentNode.childNodes; + for ( var i = 0; i < siblings.length; i++ ) { + if ( not === true && siblings[i] == elem ) continue; + + if ( siblings[i].nodeType == 1 ) + elems.push( siblings[i] ); + if ( siblings[i] == elem ) + elems.n = elems.length - 1; + } } return jQuery.extend( elems, {