Changeset 125257 in webkit


Ignore:
Timestamp:
Aug 10, 2012 12:42:06 AM (12 years ago)
Author:
arko@motorola.com
Message:

itemType.add should treat \t as a space.
https://bugs.webkit.org/show_bug.cgi?id=92991

Reviewed by Ryosuke Niwa.

Source/WebCore:

Earlier we used to append a space character i.e, ' ' to the string builder
if the last character of input string is not a space character in addToken()
method. We should add an space character if the last character of input is
not a HTML Space character like, '\n', '\r', '\t', '\f' or ' '.

We can observe the same behavior in FireFox, Opera and IE. They also treat
HTML space character as a space.

Test: fast/dom/MicroData/domsettabletokenlist-attributes-add-token.html

  • html/DOMTokenList.cpp:

(WebCore::DOMTokenList::addToken):

LayoutTests:

Added test to verifiy itemtype, itemref, itemprop attributes behavior on adding
a token in presence of trailing space characters.
Rebased existing test cases.

  • fast/dom/HTMLElement/class-list-expected.txt:
  • fast/dom/HTMLElement/class-list-quirks-expected.txt:
  • fast/dom/HTMLElement/script-tests/class-list.js:
  • fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt:
  • fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js:
  • fast/dom/MicroData/domsettabletokenlist-attributes-add-token-expected.txt: Added.
  • fast/dom/MicroData/domsettabletokenlist-attributes-add-token.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125254 r125257  
     12012-08-10  Arko Saha  <arko@motorola.com>
     2
     3        itemType.add should treat \t as a space.
     4        https://bugs.webkit.org/show_bug.cgi?id=92991
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Added test to verifiy itemtype, itemref, itemprop attributes behavior on adding
     9        a token in presence of trailing space characters.
     10        Rebased existing test cases.
     11
     12        * fast/dom/HTMLElement/class-list-expected.txt:
     13        * fast/dom/HTMLElement/class-list-quirks-expected.txt:
     14        * fast/dom/HTMLElement/script-tests/class-list.js:
     15        * fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt:
     16        * fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js:
     17        * fast/dom/MicroData/domsettabletokenlist-attributes-add-token-expected.txt: Added.
     18        * fast/dom/MicroData/domsettabletokenlist-attributes-add-token.html: Added.
     19
    1202012-08-09  Matt Falkenhagen  <falken@chromium.org>
    221
  • trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt

    r125239 r125257  
    2525Testing add in presence of trailing white spaces.
    2626PASS element.className is "x y"
    27 PASS element.className is "x\t y"
     27PASS element.className is "x\ty"
    2828PASS element.className is " y"
    2929Test invalid tokens
  • trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt

    r125239 r125257  
    2525Testing add in presence of trailing white spaces.
    2626PASS element.className is "x y"
    27 PASS element.className is "x\t y"
     27PASS element.className is "x\ty"
    2828PASS element.className is " y"
    2929Test invalid tokens
  • trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js

    r125239 r125257  
    101101createElement('x\t');
    102102element.classList.add('y');
    103 shouldBeEqualToString('element.className', 'x\t y');
     103shouldBeEqualToString('element.className', 'x\ty');
    104104
    105105createElement(' ');
  • trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt

    r124859 r125257  
    2727- Testing add in presence of trailing white spaces.
    2828PASS element.htmlFor.toString() is "x y"
    29 PASS element.htmlFor.toString() is "x\t y"
     29PASS element.htmlFor.toString() is "x\ty"
    3030PASS element.htmlFor.toString() is " y"
    3131- Test invalid tokens
  • trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js

    r124859 r125257  
    102102createElement('x\t');
    103103element.htmlFor.add('y');
    104 shouldBeEqualToString('element.htmlFor.toString()', 'x\t y');
     104shouldBeEqualToString('element.htmlFor.toString()', 'x\ty');
    105105
    106106createElement(' ');
  • trunk/Source/WebCore/ChangeLog

    r125256 r125257  
     12012-08-10  Arko Saha  <arko@motorola.com>
     2
     3        itemType.add should treat \t as a space.
     4        https://bugs.webkit.org/show_bug.cgi?id=92991
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Earlier we used to append a space character i.e, ' ' to the string builder
     9        if the last character of input string is not a space character in addToken()
     10        method. We should add an space character if the last character of input is
     11        not a HTML Space character like, '\n', '\r', '\t', '\f' or ' '.
     12
     13        We can observe the same behavior in FireFox, Opera and IE. They also treat
     14        HTML space character as a space.
     15
     16        Test: fast/dom/MicroData/domsettabletokenlist-attributes-add-token.html
     17
     18        * html/DOMTokenList.cpp:
     19        (WebCore::DOMTokenList::addToken):
     20
    1212012-08-10  Tony Chang  <tony@chromium.org>
    222
  • trunk/Source/WebCore/html/DOMTokenList.cpp

    r99645 r125257  
    5757    StringBuilder builder;
    5858    builder.append(input);
    59     if (input[input.length()-1] != ' ')
     59    if (!isHTMLSpace(input[input.length() - 1]))
    6060        builder.append(' ');
     61
    6162    builder.append(token);
    6263    return builder.toString();
Note: See TracChangeset for help on using the changeset viewer.