Page 1 of 1

Replacing named anchor with id attribute on element?

Posted: Tue May 03, 2016 1:04 am
by barbaz
Currently (at least in SeaMonkey) it's possible to use the id attribute of an element for same purpose as

Code: Select all

<a name="...">

For example, to scroll to a point "foo" in a page, the following appears equivalent:

Code: Select all

<a name="foo"></a>
<div>blah blah content</div>

Code: Select all

<div id="foo">blah blah content</div>

Either way, can click a link like this

Code: Select all

<a href="#foo">link</a>
and end up scrolled to the blah blah content.

How stable is that behavior / how much can I rely on it being there? Is this a browser quirk or standard behavior?
I discovered it by accident and can't find anything about it on MDN nor the WHATWG standards.