Source/WebCore/ChangeLog

 12013-03-08 Arpita Bahuguna <a.bah@samsung.com>
 2
 3 getAttribute does not behave correctly for mixed-case attributes on HTML elements
 4 https://bugs.webkit.org/show_bug.cgi?id=105713
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 getAttribute() and getAttributeNode() APIs do not convert the
 9 passed attribute name to lowercase before comparing against the
 10 existing attributes.
 11 The specification however states that the passed name should
 12 be converted to ASCII lowercase before checking for the existence
 13 of the given attribute. [www.w3.org/TR/domcore/#dom-element-getattribute]
 14
 15 Test: fast/dom/Element/getAttribute-case-insensitivity.html
 16
 17 * dom/Element.h:
 18 (WebCore::ElementData::getAttributeItemIndex):
 19 getAttributeItemIndex() accepts a bool param 'shouldIgnoreAttributeCase'
 20 which specifies whether or not the attribute's case should be ignored
 21 before comparison but we don't really convert the passed name to lowercase
 22 before carrying out the comparison.
 23
 24 Thus, when called from APIs such as getAttribute() and getAttributeNode()
 25 which do not explicitally convert the attribute name to lowercase
 26 before calling on this method, it fails to carry out a case-insensitive
 27 search.
 28
 29 Have thus made changes to convert the passed attribute's name to
 30 lowercase if 'shouldIgnoreAttributeCase' is true.
 31
1322013-03-08 Carlos Garcia Campos <cgarcia@igalia.com>
233
334 [BlackBerry] Use OwnPtr for CredentialBackingStore members
145190

Source/WebCore/dom/Element.h

@@inline size_t ElementData::getAttributeI
937937 unsigned len = length();
938938 bool doSlowCheck = shouldIgnoreAttributeCase;
939939
 940 const AtomicString caseAdjustedName = shouldIgnoreAttributeCase ? name.lower() : name;
940941 // Optimize for the case where the attribute exists and its name exactly matches.
941942 for (unsigned i = 0; i < len; ++i) {
942943 const Attribute* attribute = attributeItem(i);
943944 if (!attribute->name().hasPrefix()) {
944  if (name == attribute->localName())
 945 if (caseAdjustedName == attribute->localName())
945946 return i;
946947 } else
947948 doSlowCheck = true;
145190

LayoutTests/ChangeLog

 12013-03-08 Arpita Bahuguna <a.bah@samsung.com>
 2
 3 getAttribute does not behave correctly for mixed-case attributes on HTML elements
 4 https://bugs.webkit.org/show_bug.cgi?id=105713
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/dom/Element/getAttribute-case-insensitivity-expected.txt: Added.
 9 * fast/dom/Element/getAttribute-case-insensitivity.html: Added.
 10 Layout test added for verifying that getAttribute() and getAttributeNode()
 11 APIs convert the passed attribute name to lowercase before comparing
 12 against the existing attributes.
 13
1142013-03-07 Keishi Hattori <keishi@webkit.org>
215
316 Update calendar picker UI
145190

LayoutTests/fast/dom/Element/getAttribute-case-insensitivity-expected.txt

 1Test for Bugzilla bug: 105713: getAttribute does not behave correctly for mixed-case attributes on HTML testements.
 2This test verifies that the getAttribute() and the getAttributeNode() APIs convert the passed attribute name to lowercase before comparing against existing attributes.
 3
 4On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 5
 6PASS test.getAttribute('NEWATTR') is 'PASS'
 7PASS test.getAttributeNode('NEWATTR').value is 'PASS'
 8PASS test.getAttributeNS(null, 'NEWATTR') is 'FAIL'
 9PASS test.getAttribute('newattr') is 'PASS'
 10PASS test.getAttributeNode('newattr').value is 'PASS'
 11PASS test.getAttributeNS(null, 'newattr') is 'PASS'
 12PASS successfullyParsed is true
 13
 14TEST COMPLETE
 15
0

LayoutTests/fast/dom/Element/getAttribute-case-insensitivity.html

 1<html>
 2<head>
 3<script src="../../js/resources/js-test-pre.js"></script>
 4<script>
 5function runTest()
 6{
 7 description("This test verifies that the getAttribute() and the getAttributeNode() APIs convert the passed attribute name to lowercase before comparing against existing attributes.");
 8
 9 var test = document.getElementById("test");
 10 test.setAttributeNS(null, "NEWATTR", "FAIL");
 11 test.setAttributeNS(null, "newattr", "PASS");
 12
 13 if (window.testRunner) {
 14 shouldBe("test.getAttribute('NEWATTR')", "'PASS'");
 15 shouldBe("test.getAttributeNode('NEWATTR').value", "'PASS'");
 16 shouldBe("test.getAttributeNS(null, 'NEWATTR')", "'FAIL'");
 17 shouldBe("test.getAttribute('newattr')", "'PASS'");
 18 shouldBe("test.getAttributeNode('newattr').value", "'PASS'");
 19 shouldBe("test.getAttributeNS(null, 'newattr')", "'PASS'");
 20
 21 isSuccessfullyParsed();
 22 }
 23}
 24</script>
 25</head>
 26<body onload="runTest()">
 27<div>Test for Bugzilla bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=105713"> 105713:</a> getAttribute does not behave correctly for mixed-case attributes on HTML testements.</div>
 28<div id="test"></div>
 29<div id="description"></div>
 30<div id="console"></div>
 31</body>
 32</html>
0