I want to match all elements in an HTML Dom tree which have any attribute with the value "foo". I开发者_如何转开发t should either be a CSS or a XPath selector.
My naive approach would be something like this as css selector:
*[*='foo']
How is the correct syntax?
CSS does not define an attribute selector that takes a wildcard as its name.
XPath, however, does. The following expression should work:
//*[@*="foo"]
精彩评论