diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-09-16 15:50:35 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-09-16 15:50:35 +0000 |
commit | 1293e80ff9afa96198c81fa79aa267a4ee44d9d1 (patch) | |
tree | 3ff3af435af7cd6664e12e322678666aba055712 /src/jquery | |
parent | 43d3deb7c81fb4bd35a7f98c5f01f5f653b4c5a2 (diff) | |
download | jquery-1293e80ff9afa96198c81fa79aa267a4ee44d9d1.tar.gz jquery-1293e80ff9afa96198c81fa79aa267a4ee44d9d1.zip |
Fixed bug #178
Diffstat (limited to 'src/jquery')
-rw-r--r-- | src/jquery/jquery.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index ac263bced..dca186744 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, { |