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

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -