- From: Ian Hickson <ian@hixie.ch>
- Date: Wed, 15 Jul 2009 22:37:08 +0000 (UTC)
- To: Dimitry Golubovsky <golubovsky@gmail.com>, Travis Leithead <travil@microsoft.com>
- Cc: "public-html@w3.org" <public-html@w3.org>
On Wed, 15 Jul 2009, Dimitry Golubovsky wrote: > > There is a number of HTML tags whose IDL interfaces only inherit from > HTMLElement, but do not add any attributes or operations to their > parent. > > [...] > > I am thus suggesting to include empty interfaces for these tags into > subsequent published versions of html5 IDL specification. On Wed, 15 Jul 2009, Travis Leithead wrote: > > While this seems like a nice idea, would it require implementations to > change the prototype inheritance model for said tags? And if so, it > seems like a useless performance problem to have to traverse the > prototype chain of a completely empty prototype just because of a > convenience for automatic tools. I'd prefer not to introduce empty > interfaces where no new real functionality is needed. On Wed, 15 Jul 2009, Dimitry Golubovsky wrote: > > This is useful for better type approximation of interfaces (in languages > where types are meaninglful, like Haskell* that I am working with). For > Javascript, it does not make any difference, I agree. JavaScript is the main concern here, to be honest. Based on Travis' comments above, I've left the elements that have no interface as they were, with no specific interface. It would be nice if IE8 could more closely follow the DOM2 HTML and HTML5 specs though, in that there shouldn't be an HTMLPhraseElement interface, and there's no HTMLGenericElement interface in the specs either, despite what IE does. > Just by googling for "interface HTMLSpanElement", it can be seen that > tool maintainers work around that by mere reintroducing the missing > interfaces manually. > > E. g. this page: > > https://developer.mozilla.org/en/Mozilla_DOM_Hacking_Guide > > says: > > ========================== > > #define DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(_class, _interface) > _DOM_CLASSINFO_MAP_BEGIN(_class, &NS_GET_IID(_interface), PR_FALSE) > > This macro should be used for DOM classes that have no "leaf" > interface. For example, there is no HTMLSpanElement in the W3C DOM > specification. Therefore, the first interface in the prototype chain > for the span element is HTMLElement. However we do want to be able to > access HTMLSpanElement to modify it. This macro allows you to do that. > > ========================== > > Also see https://bugzilla.mozilla.org/show_bug.cgi?id=92071#c8 which > outlined the same problem (back in 2001) and shows the same list of > tags I mentioned. > > This page: > > http://msdn.microsoft.com/en-us/library/cc849009(VS.85).aspx > > shows similar thing that Microsoft does, to my understanding: defining > an interface that W3C did not define, but someone would need it. I've added HTMLSpanElement for <span>. > So, perhaps here may be the solution. W3C might "officially" provide an > IDL file with these interfaces separately from html5.idl. Why would we want multiple conflicting IDLs? I don't really understand why we would need different element types to have different interfaces. You can tell what kind of element an object is based on its tag name. Would we give every different element in XML its own interface? -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 15 July 2009 22:37:49 UTC