getAttribute does not behave correctly for mixed-case attributes on HTML elements
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2013 16:14:37 +0000 (16:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2013 16:14:37 +0000 (16:14 +0000)
commit60f5200ff87372bc603e1867586dca0e0c31d034
tree25b0ede1caadeef8578b45a0a9fee8e24ab0da13
parent5e1d3a75289d70b3e57a477e2ce98ff570821f35
getAttribute does not behave correctly for mixed-case attributes on HTML elements
https://bugs.webkit.org/show_bug.cgi?id=105713

Patch by Arpita Bahuguna <a.bah@samsung.com> on 2013-04-17
Reviewed by Andreas Kling.

Source/WebCore:

getAttribute() and getAttributeNode() APIs do not convert the
passed attribute name to lowercase before comparing against the
existing attributes.
The specification however states that the passed name should
be converted to ASCII lowercase before checking for the existence
of the given attribute. [www.w3.org/TR/domcore/#dom-element-getattribute]

Test: fast/dom/Element/getAttribute-case-insensitivity.html

* dom/Element.h:
(WebCore::ElementData::getAttributeItemIndex):
getAttributeItemIndex() accepts a bool param 'shouldIgnoreAttributeCase'
which specifies whether or not the attribute's case should be ignored
before comparison but we don't really convert the passed name to lowercase
before carrying out the comparison.

Thus, when called from APIs such as getAttribute() and getAttributeNode()
which do not explicitally convert the attribute name to lowercase
before calling on this method, it fails to carry out a case-insensitive
search.

Have thus made changes to convert the passed attribute's name to
lowercase if 'shouldIgnoreAttributeCase' is true.

LayoutTests:

* fast/dom/Element/getAttribute-case-insensitivity-expected.txt: Added.
* fast/dom/Element/getAttribute-case-insensitivity.html: Added.
Layout test added for verifying that getAttribute() and getAttributeNode()
APIs convert the passed attribute name to lowercase before comparing
against the existing attributes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/Element/getAttribute-case-insensitivity-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/getAttribute-case-insensitivity.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.h