Can I select a DOM element based on an HTML comment it contains? -


using either css3 or xpath expressions, i'd know if there way select element contains html comment.

for example:

<table>…</table> <table> <!--this 1 --> …</table> 

how can select 2nd table without using other attributes? (it may not 2nd table)

with xpath can done using comment() node test:

//table[.//comment()[contains(., 'this one')]] 

this selects table elements containing comment (at depth) contains text 'this one'.

i'm pretty sure impossible css.


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -