Changeset 205079 in webkit


Ignore:
Timestamp:
Aug 27, 2016 10:45:12 AM (8 years ago)
Author:
akling@apple.com
Message:

script.text should behave like script.textContent on setting
<https://webkit.org/b/148852>

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

  • web-platform-tests/html/semantics/scripting-1/the-script-element/script-text-expected.txt:

Source/WebCore:

HTMLScriptElement.text should behave just like .textContent when setting,
so just forward setText() to setTextContent().

Test: import/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-text.html

  • html/HTMLScriptElement.cpp:

(WebCore::HTMLScriptElement::setText):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r205077 r205079  
     12016-08-27  Andreas Kling  <akling@apple.com>
     2
     3        script.text should behave like script.textContent on setting
     4        <https://webkit.org/b/148852>
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/html/semantics/scripting-1/the-script-element/script-text-expected.txt:
     9
    1102016-08-27  Youenn Fablet  <youenn@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-text-expected.txt

    r203428 r205079  
    22PASS Getter
    33PASS Setter (non-empty string)
    4 FAIL Setter (empty string) assert_equals: expected null but got Text node ""
     4PASS Setter (empty string)
    55PASS Setter (null)
    66PASS Setter (undefined)
    7 FAIL Setter (text node reuse) assert_not_equals: got disallowed value Text node "two"
     7PASS Setter (text node reuse)
    88
  • trunk/Source/WebCore/ChangeLog

    r205076 r205079  
     12016-08-27  Andreas Kling  <akling@apple.com>
     2
     3        script.text should behave like script.textContent on setting
     4        <https://webkit.org/b/148852>
     5
     6        Reviewed by Chris Dumez.
     7
     8        HTMLScriptElement.text should behave just like .textContent when setting,
     9        so just forward setText() to setTextContent().
     10
     11        Test: import/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-text.html
     12
     13        * html/HTMLScriptElement.cpp:
     14        (WebCore::HTMLScriptElement::setText):
     15
    1162016-08-27  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/Source/WebCore/html/HTMLScriptElement.cpp

    r203337 r205079  
    8080}
    8181
     82// https://html.spec.whatwg.org/multipage/scripting.html#dom-script-text
    8283void HTMLScriptElement::setText(const String& value)
    8384{
    84     Ref<HTMLScriptElement> protectedThis(*this);
    85 
    86     if (hasOneChild() && is<Text>(*firstChild())) {
    87         downcast<Text>(*firstChild()).setData(value);
    88         return;
    89     }
    90 
    91     if (hasChildNodes())
    92         removeChildren();
    93 
    94     appendChild(document().createTextNode(value), IGNORE_EXCEPTION);
     85    setTextContent(value, ASSERT_NO_EXCEPTION);
    9586}
    9687
Note: See TracChangeset for help on using the changeset viewer.