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>
Tue, 5 Mar 2013 06:57:55 +0000 (06:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2013 06:57:55 +0000 (06:57 +0000)
commit1039f2024b8dc51dd462b009f16143fc4bde90e5
treea667af47d7f4135b755e37bb29977e8d9326895e
parent5116f42fad7f66521a18be4a1cbb6ee5a5d38124
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-03-04
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 the attribute's case should be ignored
before comparison. But inspite of this param's value we still carry
out a case sensitive search.
Have modified the same 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@144726 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