Commit 83e98c28 authored by Jörn Zaefferer's avatar Jörn Zaefferer

Added test and check for end() when there is no stack or nothing on the stack to pop()

parent 98e8ea31
...@@ -944,12 +944,15 @@ jQuery.fn = jQuery.prototype = { ...@@ -944,12 +944,15 @@ jQuery.fn = jQuery.prototype = {
* @result $("p").find("span").end() == [ <p>...</p> ] * @result $("p").find("span").end() == [ <p>...</p> ]
* *
* @test ok( 'Yahoo' == $('#yahoo').parent().end().text(), 'Check for end' ); * @test ok( 'Yahoo' == $('#yahoo').parent().end().text(), 'Check for end' );
* ok( $('#yahoo').end(), 'Check for end with nothing to end' );
* *
* @name end * @name end
* @type jQuery * @type jQuery
* @cat DOM/Traversing * @cat DOM/Traversing
*/ */
end: function() { end: function() {
if( !(this.stack && this.stack.length) )
return this;
return this.get( this.stack.pop() ); return this.get( this.stack.pop() );
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment