Move insertAdjacent*() API from HTMLElement to Element
https://bugs.webkit.org/show_bug.cgi?id=160567
Reviewed by Sam Weinig.
LayoutTests/imported/w3c:
Rebaseline several W3C tests now that more checks are passing.
* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/domparsing/insert_adjacent_html-expected.txt:
Source/WebCore:
Move insertAdjacent*() API from HTMLElement to Element:
- https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface
- https://dom.spec.whatwg.org/#element
Firefox and Chrome both have insertAdjacentHTML() on Element.
Chrome has insertAdjacentText() / insertAdjacentElement() on Element as
well. Firefox does not have this API at all.
Also align insertAdjacentHTML() with the specification so that we
now throw a NO_MODIFICATION_ALLOWED_ERR if called with "beforebegin" /
"afterend" on a parent-less element. This is as per:
- https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml
Previously, WebKit would just silently ignore such calls. The new
behavior with consistent with both Firefox and Chrome.
No new tests, rebaselined existing tests.
* dom/Element.cpp:
(WebCore::Element::insertAdjacent):
(WebCore::Element::insertAdjacentElement):
(WebCore::contextElementForInsertion):
(WebCore::Element::insertAdjacentHTML):
(WebCore::Element::insertAdjacentText):
* dom/Element.h:
* dom/Element.idl:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::insertAdjacent): Deleted.
(WebCore::HTMLElement::insertAdjacentElement): Deleted.
(WebCore::contextElementForInsertion): Deleted.
(WebCore::HTMLElement::insertAdjacentHTML): Deleted.
(WebCore::HTMLElement::insertAdjacentText): Deleted.
* html/HTMLElement.h:
* html/HTMLElement.idl:
LayoutTests:
Rebaseline several tests to reflect behavior change.
* fast/dom/HTMLElement/insertAdjacentHTML-errors-expected.txt:
* fast/dom/HTMLElement/script-tests/insertAdjacentHTML-errors.js:
* fast/dynamic/insertAdjacentElement-expected.txt:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204150
268f45cc-cd09-0410-ab3c-
d52691b4dbfc