W3C home > Mailing lists > Public > public-html@w3.org > March 2008

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

From: Simon Pieters <simonp@opera.com>
Date: Sun, 09 Mar 2008 10:45:46 +0100
To: "Ian Hickson" <ian@hixie.ch>, "HTML WG" <public-html@w3.org>
Message-ID: <op.t7qtekdpidj3kv@hp-a0a83fcd39d2.belkin>

On Sun, 09 Mar 2008 03:32:53 +0100, Ian Hickson <ian@hixie.ch> 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.


>> The second paragraph doesn't match what Firefox does. This is how it
>> 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/

-- 
Simon Pieters
Opera Software
Received on Sunday, 9 March 2008 09:46:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:13 GMT