On 5/13/11 1:26 PM, Aryeh Gregor wrote:
So it's an attribute that affects serialization in a nonstandard way?

Far as I can tell, yes.

What sort of serialization does it affect?

Gecko has way too many serialization modes, most of them not web-exposed (to support writing decent HTML editors and the like). See the various flags in http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsIDocumentEncoder.idl

The _moz_dirty flag affects most of those modes, but see below.

I just tested innerHTML,
and I found it stripped the attribute, but it didn't seem to add any
whitespace around<br>,<ol>, or<li>.

innerHTML uses OutputRaw which ensures that no prettyprinting happens ever, no matter what, even if a gun is held to the serializer's head. In particular, it overrides the _moz_dirty flag.

Similar for copy/paste.

I would suspect that there is no web-observable serialization behavior that depends on _moz_dirty.

If you're going to add pretty-printing, doesn't it make more sense to
just add the text nodes directly to the DOM?

Dunno; I didn't write the editor and don't have much experience with its internals.

You're going to have to deal with the extra nodes anyway as soon as the content 
round-trips to
a server.

This code exists for an HTML editor. There's no round-tripping involved. You're just editing some HTML.

-Boris

Reply via email to