Re: Event listeners and designMode (was: Re: several messages about contentEditable, ...)

On Sun, 9 Mar 2008, Simon Pieters wrote:
> > > 
> > >    Enabling designMode causes scripts in general to be disabled and the
> > >    document to become editable.
> > > 
> > >    When the Document has designMode enabled, event listeners registered on
> > >    the document or any elements owned by the document must do nothing.
> > >
> > > works in Firefox, AFAICT:
> > > 
> > > When you set designMode="on" on a document, all event listeners that
> > > were registered on the document with addEventListener() with a script
> > > that was itself in the same document must be ignored. Additionally, all
> > > event listeners that were registered using onXXX="" attributes in the
> > > markup, as well as .onXXX DOM attributes, must be ignored, regardless of
> > > where they came from.
> > > 
> > > This is required because editing apps still want to be able to listen to
> > > events in the document for e.g. context menus.
> > 
> > Fixed.
> 
> Oops, I should have sent feedback about this earlier. We decided to follow IE
> instead, because it was saner and easier to implement.
> 
> (IE actually reloads the iframe (from cache?) with scripts disabled, but the
> script that enabled designMode can still act upon the new document as if it
> was the old document. IE thus runs window.onunload when designMode is enabled,
> and event listeners on the window are also removed, I believe, but this
> appears to not be needed for Web compat.)
> 
> What we do is that all event listeners in the document are removed when
> designMode is enabled; event handler *content* attributes do nothing, and
> <script>s that are inserted into the document don't run while designMode is
> enabled. (The script that enabled designMode can still register new event
> listeners afterwards, and the outer document can register new event listeners
> as normal.)
> 
> I've fixed the tests to that effect:
> http://simon.html5.org/test/html/editing/event-listeners/

The spec doesn't do what IE does here, because speccing what Firefox does 
was far easier, and seemed much saner. It just disables scripts that are 
associated with the document that has designMode set. That seems 
preferable and much simpler, contrary to what you write above.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 19 August 2008 21:48:31 UTC