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

php - How to serve a file for download on WordPress -

how to share virtual sharepoint server and get it in host windows and visual studio? -