The element.hasAttribute() fails to return true for imported nodes when the attribute includes upper case characters. Steps to reproduce: 1. Have two DOM documents, say DocA and DocB. 2. Import from DocA into DocB an element node which has at least one child element node. 3. Retrieve a reference to one of the child element nodes you imported. 4. Try element.hasAttribute('someAttributeWithUpperCase'). Expected result: the element.hasAttribute() method must return true if the attribute is set for the element node. Actual result: the element.hasAttribute() method returns false, even if the attribute is set for the said element node. What is more curious is that the element.getAttribute('someAttributeWithUpperCase') method works fine, and the attribute value is properly returned. It should be noted that if the attribute has no upper case letter, then the hasAttribute() method works as expected. Additionally, the importNode() step is crucial to exposing the bug. If you try hasAttribute() with pre-existing document elements which have attributes with upper case names, it all works fine. The URL points to a minimal test case which loads an XHTML document with XMLHttpRequest and imports the element node into the main document, and then tries the element.hasAttribute() method. The test case fails in Webkit (tested with Google Chrome 2 on Windows, Safari 4 on Windows, Chromium 4 development daily build on Linux). The test case does not fail in Opera 9.6, Opera 10, Firefox 3.0, Firefox 3.5 and Konqueror 4.1.
Case sensitivity behavior is implemented differently for getAttribute() on one hand, and hasAttribute()/setAttribute()/removeAttribute()/getAttributeNode() on another. Which behavior is "right" may be subject to discussion, but having it different seems clearly wrong.
See also: bug 20247 comment 10.
Created attachment 39208 [details] Test case
Mass moving XML DOM bugs to the "DOM" Component.
All browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6 on macOS 12.5) are showing "FAILED!" and I am not sure on Web-Spec so appreciate if someone can mark this bug accordingly. Thanks!
This is config changed now that Firefox's behavior is aligned with WebKit's. imported.hasAttributeNS(null, 'camelCase') returns true.