[Webkit-unassigned] [Bug 148765] prepend should throw when it's called on a node without children

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 3 19:13:33 PDT 2015


--- Comment #2 from Chris Dumez <cdumez at apple.com> ---
(In reply to comment #0)
> document.createElement('div').prepend(document.createElement('span')) should
> throw HierarchyRequestError when ensureing pre-insertion validity.
> This bug was found by the newly added test:
> LayoutTests/http/tests/w3c/dom/nodes/prepend-on-Document.html

The case you're mentioning seems like it should work and I don't see anything in the spec [1] saying it shouldn't. Looking at http/tests/w3c/dom/nodes/prepend-on-Document.html, I see the following test case:
    test(function() {
        var parent = node.cloneNode();
        var x = document.createElement('x');
        assert_array_equals(parent.childNodes, [x]);
    }, 'Document.prepend() with only one element as an argument, on a Document having no child.');

This seems to be the case you mention and the test does not expect an exception.

[1] https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150904/b67257a2/attachment-0001.html>

More information about the webkit-unassigned mailing list