mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Added test and check for end() when there is no stack or nothing on the stack to pop()
This commit is contained in:
parent
98e8ea3186
commit
83e98c28ef
3
src/jquery/jquery.js
vendored
3
src/jquery/jquery.js
vendored
@ -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() );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user