Multiple #user_current_password on /settings/account


#1

There are two DOM elements with the same id (#user_current_password) on the WK accounts page.

  • The password you enter when changing email address
  • The current password when changing password

I’m not sure if this would cause a problem when trying to change email address or password. I just happened to notice the error on the console while testing generating a new APIv2 key on that page.


#2

It looks to be using HTML form submission, so the name would be the important part. Since both inputs have are in separate forms, there shouldn’t be any functional issues. I do agree that one or both ID attributes should be changed, since they’re supposed to be unique and all.


#3

I was thinking the “account:1” on the right was suggesting a script was trying to do something with it, but it turns out that’s not the case. ‘account’ is the html file. And while it does have a tiny bit of javascript in that doc, it’s not accessing #user_current_password.

I did find it interesting, though, that

$('#user_current_password')

only returns the first instance, whereas

document.querySelectorAll('#user_current_password')

returns both. I wonder if that’s also true of newer versions of jquery.


#4

The latest docs for jQuery say it uses getElementById with a pure id selector, and in the next paragraph says it will return a collection of either so or one element.

Strictly speaking, a document with more than one element with a given id is invalid, but browsers don’t complain because HTML is so robust.