On Fri, 20 Sep 2013 18:48:57 -0300, Dmitry Gusev <dmitry.gu...@gmail.com> wrote:

And yes, strictly speaking, this will make the document invalid, because it violates specification. But in practice things won't stop working if you put multiple elements with the same ID on a page. You won't see any errors, etc.

It's illegal (you said it was legal) and not recommended but it ends up working because browsers are lenient, maybe too lenient. ;)

The only side-effect will happen is that you won't be able to get second,
third, etc. elements by using ID selectors in JS.
But CSS styling rules will still work. In the example below you will see
content of both divs in UPPERCASE, but jQuery('#id1').length will yield 1
(this will be the first element in the order of appearance in dom), also
document.getElementById("id1") will return first element:

More reasons to avoid duplicate ids: things stop working the way you expect. :)

--
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to