Re: [IndexedDB] IDBEvent and Event

On Fri, Jun 25, 2010 at 2:20 PM, Shawn Wilsher <> wrote:
> Hey all,
> I think that IDBEvent needs to inherit from Event [1] in order for us to
> properly inherit from EventTarget in IDBRequest.  Specifically, EventTarget
> takes an EventListener [2] which has a method, handleEvent, that takes an
> Event object.  I'm not sure this makes sense for us though, so I figured I'd
> start a discussion before filing the bug.
> Cheers,
> Shawn
> [1]
> [2]

Technically I don't think inheriting from Event is required. You can
generally always use language specific means of casting between
interfaces. This is how for example Document [1] and DocumentTraversal
[2] are related. I.e. even though you receive an Event object in
handleEvent, you can always cast that to IDBEvent using whatever
casting mechanism your language have.

However if we want to follow the pattern used everywhere else for
events [3], and I definitely think we do, then IDBEvent should indeed
inherit from Event.

In javascript it makes no difference as all properties from all
interfaces should be directly available without any explicit casting
needed. For example a <div> returned from getElementById [4] has the
functions from both Element [5] and ElementCSSInlineStyle [6]
immediately available, even though getElementById returns an Element


/ Jonas

Received on Saturday, 26 June 2010 09:42:27 UTC