Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome 63+ throws [DOM] error with input type password and non-unique ids

From Chrome 63, the following error is thrown:

[DOM] Found 2 elements with non-unique id #a: (More info: https://goo.gl/9p2vKq)

https://jsfiddle.net/arnabgh/jz186qxe/

<input type="password">
<input id="a">
<input id="a">

Is there any special validation happening when input type password is used, starting from Chrome 63?

like image 805
Arnab Ghosh Avatar asked Dec 14 '17 05:12

Arnab Ghosh


1 Answers

Yes, there is; that's why you're seeing that message. But I suspect that's not what you're really asking.

If your question is why Chrome has started displaying this message, my guess is that since passworded forms tend to transmit sensitive information (namely, a password), any errors in passworded forms should be brought to the developer's attention immediately. Greater care should be taken when designing and implementing passworded forms.

The document the error message links to (which I cannot assume that you've read since you've made no acknowledgement of it in your question) has a subsection on writing standards-compliant HTML, in which the unique ID rule is re-stated:

Follow HTML guidelines

Web browsers are designed with the HTML specification in mind, and going against it can lead to unexpected issues with your web page. This means:

Element id attributes should be unique: no two elements should have the same id.

(Why that rule is the only one that's there is anyone's guess; it certainly looks like they intend to add more in the future, but it's still strange that they'd put out a document with just this one rule and call it good.)

There does not appear to be a way to disable this message, but since it doesn't prevent the page from working beyond how the duplicate IDs would have (and they don't either), if you're unable to correct the non-unique IDs yourself it's safe to ignore it.

like image 148
BoltClock Avatar answered Oct 08 '22 12:10

BoltClock