Monday, October 29, 2012

designMode and window events in HTML5

One thing I noticed, working on HTML5 editable documents is that designMode will turn off window events in Firefox (16 and 17). So, if there is a line
document.designMode = "On";
in your document code, the timers, before-unload, and similar events will not fire in Firefox.
One way out of that is not to use designMode and stick to contenteditable attributes only.

This is a part of the spec. See here.
Even more important issue is that, when the browsers implement the HTML5 specification completely, designMode should block the scripts. As the above specification states:
Enabling designMode causes scripts in general to be disabled and the document to become editable.
and also
Thus, for instance, enabling designMode will disable any event handler attributes, event listeners, timeouts, etc, that were set by scripts in the document. 

No comments: