:last-of-type(截至v1.9) vs .last()(截至v1.4):这两种方法都有效,但任何人都可以告诉我哪种方法基于效率更好?
例:
$(".item").last();
$(".item:last-of-type");
Run Code Online (Sandbox Code Playgroud)
".last()"已经存在更长时间(截至v1.4).JQuery是否内置了":last-of-type",还是只是利用CSS并捎带浏览器的功能?谁能证实这一点?
在我看来,如果适用的话,":last-of-type"会更好.
javascript jquery css-selectors pseudo-class jquery-selectors