Diff
Modified: trunk/LayoutTests/ChangeLog (210766 => 210767)
--- trunk/LayoutTests/ChangeLog 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/LayoutTests/ChangeLog 2017-01-14 17:35:56 UTC (rev 210767)
@@ -1,3 +1,15 @@
+2017-01-14 Chris Dumez <[email protected]>
+
+ Align the innerText setter with the HTML spec and Gecko
+ https://bugs.webkit.org/show_bug.cgi?id=160971
+
+ Reviewed by Alex Christensen.
+
+ Add test coverage for outerText, which is non-standard.
+
+ * fast/dom/br-set-outerText-expected.txt: Added.
+ * fast/dom/br-set-outerText.html: Added.
+
2017-01-13 Ryan Haddad <[email protected]>
Marking inspector/worker/debugger-scripts.html as flaky on macOS.
Added: trunk/LayoutTests/fast/dom/br-set-outerText-expected.txt (0 => 210767)
--- trunk/LayoutTests/fast/dom/br-set-outerText-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/br-set-outerText-expected.txt 2017-01-14 17:35:56 UTC (rev 210767)
@@ -0,0 +1,12 @@
+Tests that br.outerText does not throw
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS br.outerText = 'PASS'; did not throw exception.
+PASS br.parentNode is null
+PASS target.firstChild.data is "PASS"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS
Added: trunk/LayoutTests/fast/dom/br-set-outerText.html (0 => 210767)
--- trunk/LayoutTests/fast/dom/br-set-outerText.html (rev 0)
+++ trunk/LayoutTests/fast/dom/br-set-outerText.html 2017-01-14 17:35:56 UTC (rev 210767)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="target"></div>
+<script src=""
+<script>
+description("Tests that br.outerText does not throw");
+
+var target = document.getElementById("target");
+var br = document.createElement("br");
+target.appendChild(br);
+shouldNotThrow("br.outerText = 'PASS';");
+shouldBeNull("br.parentNode");
+shouldBeEqualToString("target.firstChild.data", "PASS");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (210766 => 210767)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-01-14 17:35:56 UTC (rev 210767)
@@ -1,3 +1,15 @@
+2017-01-14 Chris Dumez <[email protected]>
+
+ Align the innerText setter with the HTML spec and Gecko
+ https://bugs.webkit.org/show_bug.cgi?id=160971
+
+ Reviewed by Alex Christensen.
+
+ Rebaseline several W3C tests now that more checks are passing.
+
+ * web-platform-tests/domparsing/createContextualFragment-expected.txt:
+ * web-platform-tests/innerText/setter-expected.txt:
+
2017-01-13 Chris Dumez <[email protected]>
Import innerText/ w3c web-platform-tests
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt (210766 => 210767)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/createContextualFragment-expected.txt 2017-01-14 17:35:56 UTC (rev 210767)
@@ -4,26 +4,26 @@
PASS Simple test with paragraphs
PASS Don't auto-create <body> when applied to <html>
PASS <script>s should be run when appended to the document (but not before)
-FAIL createContextualFragment should work even when the context is <area> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <base> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <basefont> The operation is not supported.
+PASS createContextualFragment should work even when the context is <area>
+PASS createContextualFragment should work even when the context is <base>
+PASS createContextualFragment should work even when the context is <basefont>
PASS createContextualFragment should work even when the context is <bgsound>
-FAIL createContextualFragment should work even when the context is <br> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <col> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <embed> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <frame> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <hr> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <img> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <input> The operation is not supported.
+PASS createContextualFragment should work even when the context is <br>
+PASS createContextualFragment should work even when the context is <col>
+PASS createContextualFragment should work even when the context is <embed>
+PASS createContextualFragment should work even when the context is <frame>
+PASS createContextualFragment should work even when the context is <hr>
+PASS createContextualFragment should work even when the context is <img>
+PASS createContextualFragment should work even when the context is <input>
PASS createContextualFragment should work even when the context is <keygen>
-FAIL createContextualFragment should work even when the context is <link> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <meta> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <param> The operation is not supported.
-FAIL createContextualFragment should work even when the context is <source> The operation is not supported.
+PASS createContextualFragment should work even when the context is <link>
+PASS createContextualFragment should work even when the context is <meta>
+PASS createContextualFragment should work even when the context is <param>
+PASS createContextualFragment should work even when the context is <source>
PASS createContextualFragment should work even when the context is <track>
-FAIL createContextualFragment should work even when the context is <wbr> The operation is not supported.
+PASS createContextualFragment should work even when the context is <wbr>
PASS createContextualFragment should work even when the context is <menuitem>
-FAIL createContextualFragment should work even when the context is <image> The operation is not supported.
+PASS createContextualFragment should work even when the context is <image>
PASS <html> and <body> must work the same, 1
PASS <html> and <body> must work the same, 2
PASS Implicit <body> creation
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/setter-expected.txt (210766 => 210767)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/setter-expected.txt 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/setter-expected.txt 2017-01-14 17:35:56 UTC (rev 210767)
@@ -1,3 +1,4 @@
+abc
PASS Simplest possible test
PASS Newlines convert to <br> in non-white-space:pre elements
@@ -26,33 +27,33 @@
PASS Assigning the empty string
PASS Assigning null
PASS Assigning undefined
-FAIL innerText on <area> element The object can not be modified.
-FAIL innerText on <base> element The object can not be modified.
-FAIL innerText on <basefont> element The object can not be modified.
+PASS innerText on <area> element
+PASS innerText on <base> element
+PASS innerText on <basefont> element
PASS innerText on <bgsound> element
-FAIL innerText on <br> element The object can not be modified.
-FAIL innerText on <col> element The object can not be modified.
-FAIL innerText on <embed> element The object can not be modified.
-FAIL innerText on <frame> element The object can not be modified.
-FAIL innerText on <hr> element The object can not be modified.
-FAIL innerText on <image> element The object can not be modified.
-FAIL innerText on <img> element The object can not be modified.
-FAIL innerText on <input> element The object can not be modified.
+PASS innerText on <br> element
+PASS innerText on <col> element
+PASS innerText on <embed> element
+PASS innerText on <frame> element
+PASS innerText on <hr> element
+PASS innerText on <image> element
+PASS innerText on <img> element
+PASS innerText on <input> element
PASS innerText on <keygen> element
-FAIL innerText on <link> element The object can not be modified.
+PASS innerText on <link> element
PASS innerText on <menuitem> element
-FAIL innerText on <meta> element The object can not be modified.
-FAIL innerText on <param> element The object can not be modified.
-FAIL innerText on <source> element The object can not be modified.
+PASS innerText on <meta> element
+PASS innerText on <param> element
+PASS innerText on <source> element
PASS innerText on <track> element
-FAIL innerText on <wbr> element The object can not be modified.
-FAIL innerText on <colgroup> element The object can not be modified.
-FAIL innerText on <frameset> element The object can not be modified.
-FAIL innerText on <head> element The object can not be modified.
-FAIL innerText on <html> element The object can not be modified.
-FAIL innerText on <table> element The object can not be modified.
-FAIL innerText on <tbody> element The object can not be modified.
-FAIL innerText on <tfoot> element The object can not be modified.
-FAIL innerText on <thead> element The object can not be modified.
-FAIL innerText on <tr> element The object can not be modified.
+PASS innerText on <wbr> element
+PASS innerText on <colgroup> element
+PASS innerText on <frameset> element
+PASS innerText on <head> element
+PASS innerText on <html> element
+PASS innerText on <table> element
+PASS innerText on <tbody> element
+PASS innerText on <tfoot> element
+PASS innerText on <thead> element
+PASS innerText on <tr> element
Modified: trunk/Source/WebCore/ChangeLog (210766 => 210767)
--- trunk/Source/WebCore/ChangeLog 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/Source/WebCore/ChangeLog 2017-01-14 17:35:56 UTC (rev 210767)
@@ -1,3 +1,25 @@
+2017-01-14 Chris Dumez <[email protected]>
+
+ Align the innerText setter with the HTML spec and Gecko
+ https://bugs.webkit.org/show_bug.cgi?id=160971
+
+ Reviewed by Alex Christensen.
+
+ Align the innerText setter and createContextualFragment() with the
+ HTML specification and Gecko. In particular, they no longer throw
+ when the context element is a void element. This behavior was there
+ to match an old IE behavior but Edge dropped this behavior.
+
+ Test: fast/dom/br-set-outerText.html
+
+ * dom/Element.cpp:
+ * dom/Element.h:
+ * editing/markup.cpp:
+ (WebCore::createContextualFragment):
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::setInnerText):
+ (WebCore::HTMLElement::setOuterText):
+
2017-01-13 Joseph Pecoraro <[email protected]>
Remove ENABLE(DETAILS_ELEMENT) guards
Modified: trunk/Source/WebCore/dom/Element.cpp (210766 => 210767)
--- trunk/Source/WebCore/dom/Element.cpp 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/Source/WebCore/dom/Element.cpp 2017-01-14 17:35:56 UTC (rev 210767)
@@ -3578,44 +3578,6 @@
return URL(base, attribute.value()).string();
}
-bool Element::ieForbidsInsertHTML() const
-{
- // FIXME: Supposedly IE disallows setting innerHTML, outerHTML
- // and createContextualFragment on these tags. We have no tests to
- // verify this however, so this list could be totally wrong.
- // This list was moved from the previous endTagRequirement() implementation.
- // This is also called from editing and assumed to be the list of tags
- // for which no end tag should be serialized. It's unclear if the list for
- // IE compat and the list for serialization sanity are the same.
- if (hasTagName(areaTag)
- || hasTagName(baseTag)
- || hasTagName(basefontTag)
- || hasTagName(brTag)
- || hasTagName(colTag)
- || hasTagName(embedTag)
- || hasTagName(frameTag)
- || hasTagName(hrTag)
- || hasTagName(imageTag)
- || hasTagName(imgTag)
- || hasTagName(inputTag)
- || hasTagName(linkTag)
- || hasTagName(metaTag)
- || hasTagName(paramTag)
- || hasTagName(sourceTag)
- || hasTagName(wbrTag))
- return true;
- // FIXME: I'm not sure why dashboard mode would want to change the
- // serialization of <canvas>, that seems like a bad idea.
-#if ENABLE(DASHBOARD_SUPPORT)
- if (hasTagName(canvasTag)) {
- Settings* settings = document().settings();
- if (settings && settings->usesDashboardBackwardCompatibilityMode())
- return true;
- }
-#endif
- return false;
-}
-
ExceptionOr<Node*> Element::insertAdjacent(const String& where, Ref<Node>&& newChild)
{
// In Internet Explorer if the element has no parent and where is "beforeBegin" or "afterEnd",
Modified: trunk/Source/WebCore/dom/Element.h (210766 => 210767)
--- trunk/Source/WebCore/dom/Element.h 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/Source/WebCore/dom/Element.h 2017-01-14 17:35:56 UTC (rev 210767)
@@ -313,8 +313,6 @@
WEBCORE_EXPORT ExceptionOr<void> insertAdjacentHTML(const String& where, const String& html);
WEBCORE_EXPORT ExceptionOr<void> insertAdjacentText(const String& where, const String& text);
- bool ieForbidsInsertHTML() const;
-
const RenderStyle* computedStyle(PseudoId = NOPSEUDO) override;
bool needsStyleInvalidation() const;
Modified: trunk/Source/WebCore/editing/markup.cpp (210766 => 210767)
--- trunk/Source/WebCore/editing/markup.cpp 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/Source/WebCore/editing/markup.cpp 2017-01-14 17:35:56 UTC (rev 210767)
@@ -949,13 +949,6 @@
ExceptionOr<Ref<DocumentFragment>> createContextualFragment(Element& element, const String& markup, ParserContentPolicy parserContentPolicy)
{
- if (element.ieForbidsInsertHTML())
- return Exception { NOT_SUPPORTED_ERR };
-
- if (element.hasTagName(colTag) || element.hasTagName(colgroupTag) || element.hasTagName(framesetTag)
- || element.hasTagName(headTag) || element.hasTagName(styleTag) || element.hasTagName(titleTag))
- return Exception { NOT_SUPPORTED_ERR };
-
auto result = createFragmentForInnerOuterHTML(element, markup, parserContentPolicy);
if (result.hasException())
return result.releaseException();
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (210766 => 210767)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2017-01-14 16:19:33 UTC (rev 210766)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2017-01-14 17:35:56 UTC (rev 210767)
@@ -470,20 +470,6 @@
return WTFMove(fragment);
}
-static inline bool shouldProhibitSetInnerOuterText(const HTMLElement& element)
-{
- return element.hasTagName(colTag)
- || element.hasTagName(colgroupTag)
- || element.hasTagName(framesetTag)
- || element.hasTagName(headTag)
- || element.hasTagName(htmlTag)
- || element.hasTagName(tableTag)
- || element.hasTagName(tbodyTag)
- || element.hasTagName(tfootTag)
- || element.hasTagName(theadTag)
- || element.hasTagName(trTag);
-}
-
// Returns the conforming 'dir' value associated with the state the attribute is in (in its canonical case), if any,
// or the empty string if the attribute is in a state that has no associated keyword value or if the attribute is
// not in a defined state (e.g. the attribute is missing and there is no missing value default).
@@ -514,11 +500,6 @@
ExceptionOr<void> HTMLElement::setInnerText(const String& text)
{
- if (ieForbidsInsertHTML())
- return Exception { NO_MODIFICATION_ALLOWED_ERR };
- if (shouldProhibitSetInnerOuterText(*this))
- return Exception { NO_MODIFICATION_ALLOWED_ERR };
-
// FIXME: This doesn't take whitespace collapsing into account at all.
if (!text.contains('\n') && !text.contains('\r')) {
@@ -551,11 +532,6 @@
ExceptionOr<void> HTMLElement::setOuterText(const String& text)
{
- if (ieForbidsInsertHTML())
- return Exception { NO_MODIFICATION_ALLOWED_ERR };
- if (shouldProhibitSetInnerOuterText(*this))
- return Exception { NO_MODIFICATION_ALLOWED_ERR };
-
RefPtr<ContainerNode> parent = parentNode();
if (!parent)
return Exception { NO_MODIFICATION_ALLOWED_ERR };