[Bug 12584] outerHTML should probably merge with adjacent text nodes if applicable. IE seems to do this to some extent, and WebKit just changed to do it: <https://bugs.webkit.org/show_bug.cgi?id=52686> This test shows behavior for outerText and outerHTML: <http://so

https://www.w3.org/Bugs/Public/show_bug.cgi?id=12584

Arkadiusz Michalski (Spirit) <crimsteam@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crimsteam@gmail.com

--- Comment #2 from Arkadiusz Michalski (Spirit) <crimsteam@gmail.com> ---
If it is taken into account then analyze more tescase, because for IE I noticed
different behaviour (depending on how the tree was constructed).

<script>

        var container = document.createElement("div");
        container.appendChild(document.createTextNode("Text node 1"));
        container.appendChild(document.createTextNode("Text node 2"));

        var newEl = document.createElement("div");
        newEl.textContent = "Element content";
        container.appendChild(newEl);

        container.appendChild(document.createTextNode("Text node 3"));
        container.appendChild(document.createTextNode("Text node 4"));

        alert(container.childNodes.length);

        container.childNodes[2].outerHTML = " outerHTML ";

        alert(container.childNodes.length);
        alert(container.childNodes[1].data);

</script>

Firefox, Opera (Presto) alerts: 5, 5, Text node 2 << not merge anything

Chrome alerts: 5, 3, Text node 2 outerHTML Text node 3 << merge previous and
next sibling (only text node) if exist

IE11 alerts: 5, 4, Text node 2 outerHTML << merge previous sibling (only text
node) if exist, but if not exist and exist next sibling (only text node) then
merge with them. This is not the same what we see in example from comment0.

But if merge will became standarized then what merge, only previous and next
sibling (text node) or all contiguous Text nodes
(https://dom.spec.whatwg.org/#contiguous-text-nodes)?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 1 October 2015 18:55:50 UTC