Greasy Fork is available in English.

東方永頁機

페이지가 매겨진 다음 웹 페이지를 자동으로 로드하고 현재 페이지에 삽입합니다. 규칙 없이 수천 개의 웹 사이트를 지원합니다.

< 東方永頁機 피드백으로 돌아가기

리뷰: 좋음 - 스크립트가 잘 작동함

§
게시: 2024-09-15

I have a question.
example URL: https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q10150141230

Which selector is faster on "nextLink"?
#ans > div > div > div:nth-of-type(2) > div > [class*="ClapLv1Pagination_Chie-Pagination__Anchor--Next"]
#ans > div > div > div:nth-of-type(2) > div > a[class*="ClapLv1Pagination_Chie-Pagination__Anchor--Next"]
a[class*="ClapLv1Pagination_Chie-Pagination__Anchor--Next"]

Does this work like jquery?
Sorry but I am a beginner of programming.

Google translate

hoothin작성자
§
게시: 2024-09-16

Fewer conditions generally lead to greater efficiency. Thus, No.3 may be the fastest, and fewer conditions are more likely to remain effective after changes to the document structure.

hoothin작성자
§
게시: 2024-09-16

btw, browsers typically parse CSS selectors from right to left.

§
게시: 2024-09-16

Does browsers parse xpath from left to right?
Or Jquery?
css selector vs xpath vs jquery, Which is faster?
a[class*="ClapLv1Pagination_Chie-Pagination__Anchor--Next"]
vs.
//*[@id='ans']/div/div/div[2]/a[contains(@class, 'ClapLv1Pagination_Chie-Pagination__Anchor--Next')]

hoothin작성자
§
게시: 2024-09-16

Yes, browsers parse XPath from left to right. But in most modern browsers, CSS selectors can be more efficient than XPath, unless the document is very large and the "ID/#" is close to the target element.

답글 게시

답글을 게시하려면 로그인하세요.