[whatwg] Specification unclear about how HTMLElement.prototype.onscroll's getter/setter should behave for "body" elements
Ian Hickson
ian at hixie.ch
Mon Dec 3 16:33:23 PST 2012
On Mon, 3 Dec 2012, Boris Zbarsky wrote:
>
> 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.
I'd really like to have WebIDL define the behaviour rather than HTML,
though.
Note that onerror has a different type on HTMLElement and HTMLBodyElement.
> > 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.
onscroll is a case where there's really no reason to use a different
setter, agreed. So I've commented that out (and it's similar friends).
That still leaves onerror though.
On Tue, 4 Dec 2012, Cameron McCormack wrote:
>
> I agree. But if we really do need a separate namedItem (for bug 17201)
> on HTMLPropertiesCollection, then there is no harm in having it too, but
> I would have it not work on other HTMLCollection objects.
And vice versa.
Per our IRC discussion just now, I think I would propose that when a
method/setter/getter from a prototype of interface A is called against an
object that is of an interface B (or one of B's descendants), where B is a
subclass of A, and B defines its own method/getter/setter with the same
name, then it should throw.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list