[Bug 20225] don't allow overridden operations and attribute getters/setters to be invoked on descendant objects

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

--- Comment #6 from Boris Zbarsky <bzbarsky@mit.edu> ---
> The implementation of HTMLCollection.namedItem() is going to have to know how
> to handle being applied to HTMLCollection objects, HTMLPropertiesCollection
> objects, HTMLElement objects, Date objects, you name it, already.

There are two parts here:

1)  The binding code, which implements WebIDL.  This knows how to ensure that
the
    method is being applied to an HTMLCollection object (which includes objects
    implementing any interface that inherits from HTMLCollection), period.  It
    does this via runtime introspection of the "this" object, because it has
to.
2)  The actual method implementation, which assumes it has an HTMLCollection to
    work with (again, including subclasses).

> All I'm saying is that when it's applied to HTMLPropertiesCollection objects

And all I'm saying is that this changes the binding code from (pseudocode):

  if (object is not HTMLCollection) {
    throw;
  }
  call implementation;

to (still pseudocode)

  if (object is not HTMLCollection or object is HTMLPropertiesCollection) {
    throw;
  }
  call implementation;

which means double the work, and that work is one of the most expensive parts
of this call to start with.  Maybe that's an acceptable cost, but it's not one
we should just blindly take.

> because the rest of the code 

Which code?  Are you talking about the binding code, the implementation code,
web page code, something else?

> The alternative is to define how it works on HTMLPropertiesCollection objects

Yes.

> but I don't think that scales.

Why not?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Thursday, 6 December 2012 05:47:21 UTC