On Mon, Oct 7, 2013 at 10:01 PM, Adam Barth <
aba...@chromium.org> wrote:
> On Mon, Oct 7, 2013 at 6:20 AM, Philip Jägenstedt <
phi...@opera.com> wrote:
>>
>> However, perhaps I should have started this by actually comparing the
>> existing Document.idl, Element.idl and Window.idl. One need not look
>> further than onabort before discovering that all three are different:
>>
>> Document.idl:
>> [NotEnumerable] attribute EventHandler onabort;
>>
>> Element.idl:
>> [NotEnumerable, PerWorldBindings] attribute EventHandler onabort;
>>
>> Window.idl:
>> attribute EventHandler onabort;
>>
>> At a glance, I found no attribute where the IDL was actually the same
>> for all three interfaces.
>
>
> What does the spec say? Is this property supposed to be enumerable in
> Window.idl, or is that a bug from our copy/pasta?
The spec simply says "attribute EventHandler onabort;" I assume this
means the attribute should be enumerable, on all three implementing
interfaces.
Note also that the spec says "HTMLElement implements
GlobalEventHandlers" whereas Blink puts all of these properties on
Element. I wouldn't mind attempting this move, but if it turns out to
not be compatible with Web content, the spec(s) will have to change.
> I'm pretty sure we can drop PerWorldBindings in this case. That's really
> only needed on extremely hot APIs. We could research when it was added to
> Element.idl to understand why it was put there.
I'll investigate, it seems like a simple first step to reduce the
number of differences.
> In these sorts of refactoring projects, it's not uncommon to find a bunch of
> hairballs. In SF, we have a Yak Shave statue for folks who clean up these
> sorts of issues as they work on the code.
>
>
http://en.wiktionary.org/wiki/yak_shaving
>
>> The spec doesn't say anything about this, so I suppose that it thinks
>> that the default visibility (whichever it is) should be used
>> everywhere. Here's a demo that shows that there are indeed a bunch of
>> enumerable onevent properties on Window but not on Document or
>> Element:
>>
>>
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2552
>>
>> In Gecko, a lot of onevent properties are actually visible on all
>> three interfaces.
>
>
> If the spec doesn't have the NotEnumerable attribute, that means the
> property is enumerable. If you research other user agents and find that
> they're consistent in not enumerating various properties, we should change
> the specs to match reality.
I just tested Presto and it turns out we (Opera) enumerated these
properties on document and element but not on window, i.e. precisely
the opposite of what Blink does. I haven't tested IE.
To me, it seems simplest to just let the attributes be enumerable
everywhere, especially since Gecko seems able to get away with that.
I've created
http://code.google.com/p/chromium/issues/detail?id=305112
to work towards getting in sync with the spec, which may very well
require changing the spec on some points.
Philip