Re: Conflicts between D3E and Web DOM Core

Thanks for your feedback and doing this analysis!

On Thu, 03 Mar 2011 23:06:33 +0100, Jacob Rossi <jrossi@microsoft.com>  
wrote:
> I've identified some potential conflicts between Web DOM Core and DOM L3  
> Events:
>
>  1. WDC allows the dispatch of an event without having initialized its  
> event object (e=document.creatEvent("Event"); window.dispatchEvent(e);).  
> No major browser supports this today and there are not any valid use  
> cases for this behavior (that I can think of), so why make  
> implementations change?

Why should we have the artificial restriction? What exactly does  
initEvent() do that is required here? I wanted the specification to both  
reflect implementations and make some sense. E.g. in Gecko getting  
Event.type before invoking initEvent() throws an exception. But there is  
no real reason why that should be the case. Nor is that defined by DOM  
Level 3 Events, so changes will be needed either way.


> 2. cancels and bubbles are now optional arguments for initEvent() in  
> WDC.  How does this merge with the other init___Event( ) methods which  
> are have cancels and bubbles in the middle of their methods? I think  
> there's some support for improving how the init methods behave, but this  
> doesn't really solve that problem. I'd rather see D3E keep these are  
> required and then Web DOM Core consider taking the task of event object  
> constructors. [1]

Reverted for now:  
https://bitbucket.org/ms2ger/dom-core/changeset/c8ce92f749e3

(I will put forward a proposal for easier event creation in the firing  
thread.)


> 3. Event names can be empty strings but not null in WDC [2]. Why exclude  
> null, it's not any more nonsensical than "". IE9, Chrome, and Opera all  
> allow null as a name.

As pointed out by Glenn this is not true. Note also that DOM Level 3  
Events does seem to have restrictions here. No whitespace characters  
allowed? dispatchEvent() seems to say a INVALID_CHARACTER_ERR exception is  
thrown for an incorrect Event.type...


> 4. Calls to dispatchEvent(evt) where evt is an event object that's  
> already in the middle of dispatch throw an INVALID_STATE_ERR according  
> to WDC [3], but a DISPATCH_REQUEST_ERR according to D3E [4]. Why change  
> the name/code?

I thought it would be nice if we could get rid of EventException  
completely. XMLHttpRequest and lots of other APIs use DOMException. Seems  
kind of unnecessary to use a different one just for this method.


> [1] http://www.w3.org/2008/webapps/track/issues/129
> [2]  
> http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-eventtarget-addeventlistener
> [3]  
> http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-eventtarget-dispatchevent
> [4]  
> http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-EventException


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Friday, 4 March 2011 08:53:05 UTC