Changeset 144726 in webkit


Ignore:
Timestamp:
Mar 4, 2013, 10:57:55 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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.

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r144724 r144726  
     12013-03-04  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 Andreas Kling.
     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-04  Joshua Bell  <jsbell@chromium.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r144725 r144726  
     12013-03-04  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 Andreas Kling.
     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 the attribute's case should be ignored
     21        before comparison. But inspite of this param's value we still carry
     22        out a case sensitive search.
     23        Have modified the same to convert the passed attribute's name to
     24        lowercase if 'shouldIgnoreAttributeCase' is true.
     25
    1262013-03-04  Kunihiko Sakamoto  <ksakamoto@chromium.org>
    227
  • trunk/Source/WebCore/dom/Element.h

    r144010 r144726  
    942942        const Attribute* attribute = attributeItem(i);
    943943        if (!attribute->name().hasPrefix()) {
    944             if (name == attribute->localName())
     944            if ((shouldIgnoreAttributeCase ? name.lower() : name) == attribute->localName())
    945945                return i;
    946946        } else
Note: See TracChangeset for help on using the changeset viewer.