【发布时间】:2014-05-08 08:19:12
【问题描述】:
以下 CSS 选择器在 jQuery 中工作,所以我希望它在 QueryPath 3.0.0 中工作,但它只返回一个空值:
div#caption:has(h2):contains('Product Description') div:first
这是我想要检索的内容:
<div id="caption"><h2>Product Description</h2><div>Text I want to capture is here.</div><div>I don't want this text.</div><br clear="all" /></div>
选择器有什么问题?
【问题讨论】:
-
这不是一个有效的 CSS 选择器。
:has()、:contains()和:first都是特定于 jQuery 的。这可能取决于 QueryPath 是使用 jQuery 选择器还是 CSS 选择器。 -
@BoltClock :has()、:contains() 和 :first 在大多数情况下都可以在 QueryPath 中使用。不知道为什么他们在这种情况下不这样做。
标签: php jquery-selectors css-selectors querypath