Re: Exposing constructors of readonly interfaces to web authors

On Mon, Jun 30, 2014 at 8:11 AM, Boris Zbarsky <> wrote:
> On 6/29/14, 10:55 PM, Robert O'Callahan wrote:
>> Are you saying we cannot have a WebIDL interface (DOMRectReadOnly)
>> representing a "common base class" for DOMQuad.bounds rectangles and
>> mutable DOMRects, because there are separate implementations with
>> different internal state?
> You can, but it takes some gyrations: effectively defining some sort of
> virtual hooks on the parent class and implementing them in the subclasses.
> The main benefit would be that scripts would have a one-stop place to hook
> getters on all rectangles by doing that on DOMRectReadOnly.prototype, but
> it's not terribly clear to me how useful that is.

Well, it lets people do precisely what RoC was imagining:

> It's easy to imagine extending DOMRectReadOnly with more functionality common to the subclasses, e.g. area(), contains(point), intersects(rect).


Received on Monday, 30 June 2014 22:13:44 UTC