Bugzilla – Bug 16335
undefined attribute values
Last modified: 2012-05-05 19:08:45 UTC
PORTING from TRACKER, ISSUE-186:
The result of getting attributes on an event object e created through
var e = document.createEvent("Event")
appears to be completely undefined. What does eventPhase return, what does
bubbles return, etc? Also after dispatching of an event is finished it is
unclear what e.g. eventPhase and currentTarget ought to return. DOM Core
attempts to cover this in detail.
Working on adding "un-initialized values" to all the attributes, in addition to the "after dispatch" values of various attributes.
Note: 3/5 browsers agree that the uninitialized value of eventPhase should be 0 (not AT_TARGET as described in DOM4). Of the other two non-agreeing browsers, they don't agree with each other. I think I'll stick with 0.
If you keep eventPhase with value 0 you'll have to invent a constant for it too. We have no exceptions to that rule thus far. I thought adding a constant would be a greater change than defining the default value, but I'm happy to add a constant.
(In reply to comment #3)
> If you keep eventPhase with value 0 you'll have to invent a constant for it
> too. We have no exceptions to that rule thus far. I thought adding a constant
> would be a greater change than defining the default value, but I'm happy to add
> a constant.
I'm thinking that a constant would be the easiest way to align the implementations. I checked HTML5 + all the WebApps specs looking for a suitable existing constant--the closest match was "NONE" from HTMLTrackElement. ("UNSENT" from XHR could also be used. There's also a value of "uninitialized" for the effectAllowed of DataTransfer, which is a string value (not a constant).
So, I think I'll just stick with UNINITIALIZED unless anyone objects.
I think I prefer NONE as UNINITIALIZED is hard to spell. But up to you.
Just for the record. Currently Safari/Chrome/IE do 0, Firefox 2, and Opera 1, right?
(In reply to comment #5)
> I think I prefer NONE as UNINITIALIZED is hard to spell. But up to you.
> Just for the record. Currently Safari/Chrome/IE do 0, Firefox 2, and Opera 1,
No objection on NONE here--it also works well, since the eventPhase value goes back to 0 after dispatch in Safari/Chrome/IE and at that point it's initialized but in none of the other defined phases, so NONE works better :)
And yes, those are the current implementation values for eventPhase.
Updated DOM4: http://dvcs.w3.org/hg/domcore/rev/98a9587a515c
Filed bugs. Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=751286 WebKit: https://bugs.webkit.org/show_bug.cgi?id=85397 Opera: CORE-46127
DOM3 Events spec now updated with these changes.
Added a test: http://dvcs.w3.org/hg/webapps/rev/f7745b53fc02