开发者

firebug and _moz_dirty

I am developing Javascript app that will wrap every line of text entered inside iframe (designmode) with P (or div) like it happens by default in IE.

For now I am not pasting my code because I just started, the first problem is when i type some text in firefox an开发者_如何学Pythond even before I click enter or calling any function firebug inserts

<br _moz_dirty="">

under the entered text.

Why? How can I prevent it?

If you still need my code please tell.


As the _moz_-prefix suggests, this is a Mozilla-internal property. It isn't inserted by Firebug, but rather by the core editor functionality in Gecko. You can't prevent it; ignore it or work around it.


#myEditableDiv br {display:none;}

It's something Mozilla uses to prevent empty containers collapsing and occasionally inserts at seemingly random times too.

The question is, if they knew it was a dirty hack then why did they do it?


The _moz_dirty attribute is used to indicate that the node needs to be pretty-printed when the document is saved, although it shouldn't appear in web pages, only in SeaMonkey Composer and SeaMonkey and Thunderbird's HTML Message Compose.


The Gecko editor used to put it there because it needed it to give it somewhere to put the cursor. I believe this is fixed in Firefox 4.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜