Re: The future of XML related technologies in Mozilla
Lucky <[email protected]> Wed, 01 Nov 2006 22:19:03 -0500
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Message-ID | <[email protected]> |
Jonas Sicking wrote:
> Ian Hickson wrote:
>> On Wed, 1 Nov 2006, Boris Zbarsky wrote:
>>> OK, I sense a significant communications failure here. Let's say we
>>> have:
>>>
>>> <div id="foo">Text</div>
>>>
>>> and script as follows:
>>>
>>> var node = document.getElementById("foo");
>>> var str = (new DOMSerializer()).serializeToString(node);
>>> var str2 = node.innerHTML.
>>>
>>> Then str is the string: '<div id="foo">Text</div>' while str2 is the
>>> string: 'Text'
>>>
>>> To get the string in |str| using innerHTML, you would have to use the
>>> code with importNode and company that I posted in my previous post.
>>> This is why outerHTML exists, fwiw.
>>
>> Oh, I see what you're saying. I have no objection to introducing
>> outerHTML as well. Currently I haven't done so mostly because Mozilla
>> doesn't support it, so I assumed there wasn't strong demand for it.
>
> The problem with outerHTML is that it makes sense to get, but is very
> confusing to set. I.e setting outerHTML removes the current node from
> the document so any additional operations on the node after that are
> effectively no-ops. I.e. something like
>
> node = document.getElementById("foo");
> node.outerHTML = "<ol><li>hi</li></ol>";
> node.setAttribute("start", 5);
>
> won't do what many people would think it does. Of course, we could make
> outerHTML readonly, but that'd be confusing because innerHTML is not,
> and outerHTML is not in IE.
>
> / Jonas
outerHTML is in IE?
<http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/outerhtml.asp>
and works are you are speaking, replaces the element with the newly
parsed fragment.
sorry to interrupt.