On 12/3/12 2:05 PM, Ian Hickson wrote:
What do browsers do?

WebKit and Opera don't put the property on the prototype at all, so the whole issue is not even testable there. This obviously doesn't follow WebIDL, but that's not relevant here.

It looks like Gecko currently doesn't allow the "onscroll" setter gotten from HTMLElement.prototype to be invoked on things whose prototype is not exactly HTMLElement.prototype. In particular, applying it to an HTMLBodyElement throws. This is an artifact of this property being implemented via XPConnect, unlike a lot of other DOM properties; we're in the process of switching to WebIDL for the bindings here, which is why the question arose.

IE9 in IE9 standards mode seems to depend on the exact event handler. Specifically, assuming I didn't mess up my tests:

1)  For "onload", "onfocus", "onblur" it seems to forward the set
    to the window even if it's invoked via the HTMLElement.prototype
    setter.
2)  For "onscroll", "onerror" it seems to never forward to the
    window, no matter how you set it.

So in terms of compat, I claim there are no constraints here.  ;)

This should probably be defined in WebIDL.

You have IDL like this:

  interface Foo {
    attribute EventHandler onscroll;
  };
  interface Bar : Foo {
    attribute EventHandler onscroll;
  };

WebIDL already defines how this behaves: there are getters/setters on both Foo.prototype and Bar.prototype, and it's up to the spec prose to decribe how those getters/setters actually behave. That's really what's missing here, no? Again, there are several possible behaviors; the question is which one we want for this particular case.

It relatess also to:

    https://www.w3.org/Bugs/Public/show_bug.cgi?id=17201

It's a similar situation, yes. But in this case I don't see why you'd need an IDL annotation of any sort at all. If you want the behavior to be the same, just don't define onscroll on Bar at all and define the one on Foo to special case the two Foo subclasses you care about here. If you don't want it to be the same, the IDL annotation doesn't help you.

-Boris

Reply via email to