- From: Jonas Sicking <jonas@sicking.cc>
- Date: Sat, 26 Jun 2010 02:41:35 -0700
- To: Shawn Wilsher <sdwilsh@mozilla.com>
- Cc: public-webapps WG <public-webapps@w3.org>
On Fri, Jun 25, 2010 at 2:20 PM, Shawn Wilsher <sdwilsh@mozilla.com> 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] http://www.w3.org/TR/DOM-Level-3-Events/#interface-Event > [2] http://www.w3.org/TR/DOM-Level-3-Events/#interface-EventListener 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 interface. [1] http://www.w3.org/TR/DOM-Level-3-Core/core.html#i-Document [2] http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html#Traversal-Document [3] http://www.w3.org/TR/DOM-Level-3-Events/ [4] http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-getElBId [5] http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614 [6] http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle / Jonas
Received on Saturday, 26 June 2010 09:42:27 UTC