[whatwg] [WA1] The a element could be empty
S. Mike Dierken
mdierken at hotmail.com
Sun Sep 4 14:14:31 PDT 2005
reference the point between the third and fourth paragraphs? For example,
how would you reference it from another document?
Possibly via some URI with a local xpath style anchor -
If any element can have an id attribute, that would be sufficient - empty
<a> elements aren't strictly required to allow inbound links.
----- Original Message -----
From: "Jasper Bryant-Greene" <jasper at bryant-greene.name>
To: <whatwg at whatwg.org>
Sent: Saturday, September 03, 2005 8:17 PM
Subject: Re: [whatwg] [WA1] The a element could be empty
> S. Mike Dierken wrote:
> >>Yes, but it still shouldn't be empty, how can you link to part of a page
> > that's nothing?
> > You mean 'why' rather than how? I suppose if you had a system that
> > your boss to tell you "add a paragraph of blurbiage after paragraph 3
> > before paragraph 4", how you you reference that point between existing
> > elements?
> Certainly not with an empty <a> element, that's for sure. In this HTML
> | <body>
> | <p>First paragraph...</p>
> | <p>Second paragraph...</p>
> | <p>Third paragraph...</p>
> | <p>Fourth paragraph...</p>
> | </body>
> Some JS like this:
> | var body = document.getElementsByTagName('body');
> | var fourthParagraph = body.getElementsByTagName('p');
> | var newParagraph = document.createElement('p');
> | newParagraph.appendChild(document.createTextNode('New paragraph'));
> | body.insertBefore(newParagraph, fourthParagraph);
> Would do exactly that.
> Jasper Bryant-Greene
> Freelance web developer
More information about the whatwg