Skip to content

Commit

Permalink
Added test and check for end() when there is no stack or nothing on t…
Browse files Browse the repository at this point in the history
…he stack to pop()
  • Loading branch information
jzaefferer committed Nov 7, 2006
1 parent 98e8ea3 commit 83e98c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/jquery/jquery.js
Expand Up @@ -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() );
},

Expand Down

0 comments on commit 83e98c2

Please sign in to comment.