Post

HTML forms are so broken. With every other element, you can do this: <div id="foo"> div⁠.⁠id // "foo" Forms work the same way too: <form id="bar"> form⁠.⁠id // "bar" But then: <form id="bar"> <input name="id"> form⁠.⁠id // the input element 🤡

And it doesn't stop with attributes. An input named "click" breaks form⁠.⁠click(), etc.

Now guess what happens to document.activeElement if you have this: <form name="activeElement"> Yes, it’s as bad as it gets.

If you add the name attribute to the form element itself, it pollutes the document scope.

0 reposts0 likes