[whatwg] image captions
Anne van Kesteren
fora at annevankesteren.nl
Tue Jun 27 06:10:51 PDT 2006
Quoting David Walbert <dwalbert at learnnc.org>:
> For scripting purposes I have occasionally needed to tie an image and
> its caption explicitly by giving them related IDs that a particular
> javascript function can call (e.g. img id="img1" and p id="img-
> caption"), and it would be helpful in these situations to have a
> standard syntax for that explicit relation. But the availability of
> such syntax should not imply that everyone needs to use it for all
> markup, all the time; I can't see it being useful in ordinary web
> design (to the reader/user, which should ultimately be the point)
> unless there are actions associated with the image and caption.
If the relationship between the image and caption is well defined. For
example, when the next sibling _element_ of <img> is <p>, <p> is the
caption of <img> you can easily introduce some DOM attribute on
HTMLImageElement named caption that gives you back the
HTMLParagraphElement associated with it.
--
Anne van Kesteren
<http://annevankesteren.nl/>
More information about the whatwg
mailing list