Skip to content
Permalink
Browse files

Added test and check for end() when there is no stack or nothing on t…

…he stack to pop()
  • Loading branch information
jzaefferer committed Nov 7, 2006
1 parent 98e8ea3 commit 83e98c28ef8aba11e525bf4266f8454232236ca0
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/jquery/jquery.js
@@ -944,12 +944,15 @@ jQuery.fn = jQuery.prototype = {
* @result $("p").find("span").end() == [ <p>...</p> ]
*
* @test ok( 'Yahoo' == $('#yahoo').parent().end().text(), 'Check for end' );
* ok( $('#yahoo').end(), 'Check for end with nothing to end' );
*
* @name end
* @type jQuery
* @cat DOM/Traversing
*/
end: function() {
if( !(this.stack && this.stack.length) )
return this;
return this.get( this.stack.pop() );
},

0 comments on commit 83e98c2

Please sign in to comment.
You can’t perform that action at this time.