See https://html.spec.whatwg.org/multipage/scripting.html#dom-script-text HTMLScriptElement.prototype.text must return the concatenation of the data of Text nodes that are its direct children, and must not include texts of other node types or non-direct child Text nodes. This bug was found by the newly added test: LayoutTests/http/tests/w3c/html/semantics/scripting-1/the-script-element/script-text.html
<rdar://problem/22587759>
Created attachment 262618 [details] Patch
Comment on attachment 262618 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262618&action=review > Source/WebCore/ChangeLog:5 > + We usually put the radar link under the bugzilla one when there is one. > Source/WebCore/ChangeLog:8 > + Don't include text from non-direct children in script.text. Please provide a link to the spec that says that it is the right thing to do. Also please indicate the behavior of Chrome and Firefox to make sure this change is web-compatible. > Source/WebCore/dom/ScriptElement.cpp:386 > + for (Text* text = TextNodeTraversal::firstChild(m_element); text; text = TextNodeTraversal::nextSibling(*text)) auto* > LayoutTests/imported/w3c/ChangeLog:4 > + https://bugs.webkit.org/show_bug.cgi?id=148851 We usually put the radar link under the bugzilla one when there is one.
Comment on attachment 262618 [details] Patch Attachment 262618 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/254840 New failing tests: fast/dom/script-getElementById-during-insertion.html
Created attachment 262622 [details] Archive of layout-test-results from ews102 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-mavericks Platform: Mac OS X 10.9.5
Comment on attachment 262618 [details] Patch Attachment 262618 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/254854 New failing tests: fast/dom/script-getElementById-during-insertion.html
Created attachment 262623 [details] Archive of layout-test-results from ews106 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Created attachment 262650 [details] Patch
Comment on attachment 262650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262650&action=review r=me with nit fix. > LayoutTests/fast/dom/script-subtext-in-script-elements.html:11 > + <div id="result">PASS</div> nit: I would mark this as FAIL initially... > LayoutTests/fast/dom/script-subtext-in-script-elements.html:17 > + script.appendChild(document.createTextNode("")); ... then set it to "PASS" here to make sure the script is executed.
Created attachment 262658 [details] Patch
Comment on attachment 262658 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262658&action=review > LayoutTests/fast/dom/script-subtext-in-script-elements.html:16 > + document.getElementById('result').innerHTML = 'PASS'; Er, I meant in the script you're inserting. > LayoutTests/fast/dom/script-subtext-in-script-elements.html:19 > + script.appendChild(document.createTextNode("")); script.appendChild(document.createTextNode("document.getElementById('result').innerHTML = 'PASS'"));
Created attachment 262660 [details] Patch
Comment on attachment 262660 [details] Patch Clearing flags on attachment: 262660 Committed r190703: <http://trac.webkit.org/changeset/190703>
All reviewed patches have been landed. Closing bug.