Skip to content

关于新选择器的疑问 #894

Answered by lisonge
AIsouler asked this question in Q&A
Feb 22, 2025 · 3 comments · 8 replies
Discussion options

You must be logged in to vote

新选择器的表达式能否使用快速查询?

可以,A || B && C 的首个快速查询等价于它们单独的首个快速查询之和,此外在 !(A) 内的首个快速查询被忽略

(A[id='a']) || (B[id='b']) && (C[id='c']) && !(D[id='d']) 的首次快速查询合并为 [id='a' || id='b' || id='c']


以下两种写法在查询效率上有区别吗?使用新的表达式是否好一些?

有区别,前者进行一次快速查询和一次普通查询,后者只有一次快速查询,可能存在查不到的情况

在没有关系选择器的情况下,下面两个选择器是完全等价的

([id='233']) || ([text='abc']) == [(id='233') || (text='abc')]

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by lisonge
Comment options

You must be logged in to vote
5 replies
@lisonge
Comment options

@AIsouler
Comment options

@lisonge
Comment options

@AIsouler
Comment options

@lisonge
Comment options

Comment options

You must be logged in to vote
3 replies
@lisonge
Comment options

@AIsouler
Comment options

@lisonge
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants