Previous Message
Next Message

Select tag based on descendant tag attribute?

Sent by Jukka K. Korpela on 11 May 2008 09:09


George Adders wrote:

> I need to get rid of a table row from dynamically generated content
> that's outside of my control. Is this possible? (I cannot share the
> link because the site is invitation-only and requires an account).

You could upload a demo page with no sensitive content on a public 
server and post the URL. With the given information, the answer is "no, 
you can't select an element on the basis of inner markup" (like an 
attribute of a descendant), but perhaps the table as a whole gives an 
idea of how the problem row might be referred to, without adding a class 
attribute to it (the obvious solution, which is obviously not feasible 
here).

> <tr>
> <td><img src="red.gif"></td>
> <td>Miscellaneous text</td>
> </tr>
>
> Is there a way to select an element based on the attribute of a
> descendant tag? Something like tr(img[src="red.gif"])

No. You could of course make the image disappear in rendering, but if 
the other cell contains text, the row won't go away.

> Is there any other way to select the tr element in the above example,
> considering it has no distinguishing properties apart from the src
> attribute of the img descendant, and that it's never in the same place
> in the table twice? Custom vendor implementations would be fine.

In CSS as currently defined and implemented, there's no way unless you 
can modify the markup. Using client-side scripting, this would be fairly 
easy, with the usual caveats, but I guess that if you could add 
scripting, you could just as well add a class attribute.

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: