Jquery end()的实际工作情况是什么

Jquery end()的实际工作情况是什么,jquery,Jquery,我在做的时候遇到了一段代码 $( "#content" ) .find( "h3" ) .eq( 2 ) .html( "new text for the third h3!" ) .end() // Restores the selection to all h3s in #content .eq( 0 ) .html( "new text for the first h3!" ); 代码中的注释让我质疑,它会将选择恢复

我在做的时候遇到了一段代码

$( "#content" )
    .find( "h3" )
    .eq( 2 )
        .html( "new text for the third h3!" )
        .end() // Restores the selection to all h3s in #content
    .eq( 0 )
        .html( "new text for the first h3!" );
代码中的注释让我质疑,它会将选择恢复到
#content
还是
content
中的所有H3:

$( "#content" )
    .find( "h3" )
    .eq( 2 )
        .html( "new text for the third h3!" )
        .end() // Restores the selection to all h3s in #content
    .eq( 0 )
        .html( "new text for the first h3!" );
此处“将选择恢复到#content中的所有h3”意味着它将返回到
content
jQuery对象中的
h3
来执行
eq(0)
,而不是
eq(2)


它将重置为文章中读取的dom对象h3,但我认为它应该恢复为原始内容selection@void不如您所见,
.find()
在上下文中使用。因此,在
#content
的上下文中,实际的选择器是
h3
。不,如果执行
.end().end()
(两次),则它将转到
#content
。在这里,用户希望将
eq()
应用于
h3
元素,而不是
content
。好的,这意味着,.end()将回复到上一个选择?如果您放置.find(h3).end(),则它将转到上下文