替换所有<a>元素*没有*属性

时间:2019-07-10 14:38:41

标签: html intellij-idea structural-search

我想使用结构搜索来查找例如:

<a data-foo="bar" style="width: 1px;">
<a data-bar="foo">

但是不是

<a data-foo="bar" style="width: 1px;" href="https://google.com">
<a href="#" data-bar="foo">

是否可以添加脚本过滤器以完成此目标?

2 个答案:

答案 0 :(得分:1)

将搜索模板设置为:

A

<$tag$ $attributeA$=$valueA$ /> 上,用$attributeA$进行过滤。不要过滤text=href, count=[0,0]

答案 1 :(得分:-1)

使用:not(),例如:

document.querySelector('a:not([href])')