【问题标题】:CSS selector exclude elements, hpricotCSS 选择器排除元素,hpricot
【发布时间】:2010-05-04 15:41:31
【问题描述】:

我正在尝试编写一个 CSS 选择器,它使用 hpricot 选择除脚本元素之外的所有内容,我可以轻松选择 select-me div 的所有内容,然后删除脚本元素,但我想知道它是否可以使用将排除脚本元素的选择器:

<div class='select-me'>
<p>This is some text</p>
<script>
javascript would be here
</script>
<p>This is some text</p>
</div>

所以最后我回来了:

<div class='select-me'>
<p>This is some text</p>
<p>This is some text</p>
</div>

干杯

【问题讨论】:

    标签: css ruby selector hpricot


    【解决方案1】:

    你可以试试:

    "div.select-me :not(script)"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-04
      • 2016-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多