W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2007

[whatwg] Attributes vs. Elements

From: <whatwg@robertdot.org>
Date: Mon, 12 Mar 2007 17:23:51 -0600 (CST)
Message-ID: <50374.66.151.50.244.1173741831.squirrel@www.robertdot.org>
ddailey wrote:
> The ease of using DOM methods to find tags, as opposed to attributes,
> tends  to suggest that all things having href's should be easily
> findable by  script. <a> works nicely for that, but would the
> availability of a  document.links array then include all things with
> href's?

In JavaScript, document.links would work, though I've been indoctrinated
into the modern DOM camp and like to use
document.getElementsByTagName("a").  I try to avoid DOM 0 style
collections, but for things like form validation, I end up using the
.elements collection frequently.  I'm sure I could adjust my way of
thinking if I needed to.

My gripe, however, was with CSS attribute selectors.[1]  I didn't really
make that clear.  IE 6 doesn't do them.  However, as someone pointed out,
something like td:link would work.  I wouldn't need td[href] to get at
"all tds with hrefs".  Assuming that is true, and it had support from the
4 major browsers, the href-on-all-attributes would work pragmatically.

If it would make sense semantically / ideologically, I'm still unsure.  I
don't know if the existence of the anchor element was lack of foresight or
if it has a real semantic meaning like em or strong that is independent of
the href.

[1] http://www.w3.org/TR/CSS21/selector.html#attribute-selectors
Received on Monday, 12 March 2007 16:23:51 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:53 UTC