WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
28976
element.hasAttribute() fails to return true for nodes imported from XML documents
https://bugs.webkit.org/show_bug.cgi?id=28976
Summary
element.hasAttribute() fails to return true for nodes imported from XML docum...
Mihai Sucan
Reported
2009-09-04 09:59:14 PDT
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.
Attachments
Test case
(836 bytes, text/html)
2009-09-08 13:26 PDT
,
Sam Weinig
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2009-09-07 22:22:47 PDT
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.
Alexey Proskuryakov
Comment 2
2009-09-08 12:03:18 PDT
See also:
bug 20247 comment 10
.
Sam Weinig
Comment 3
2009-09-08 13:26:08 PDT
Created
attachment 39208
[details]
Test case
Lucas Forschler
Comment 4
2019-02-06 09:02:45 PST
Mass moving XML DOM bugs to the "DOM" Component.
Ahmad Saleem
Comment 5
2022-08-02 04:59:00 PDT
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!
Ryosuke Niwa
Comment 6
2022-08-02 09:17:54 PDT
This is config changed now that Firefox's behavior is aligned with WebKit's. imported.hasAttributeNS(null, 'camelCase') returns true.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug