- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Sat, 02 Apr 2011 11:46:02 +0200
- To: public-webapps <public-webapps@w3.org>
On 2011-04-02 07:20, Cameron McCormack wrote: > Lachlan Hunt: >>> [Supplemental] >>> interface Element { >>> Element querySelector(in DOMString selectors, in optional any >>> ... >>> } >> >> This adds another method to Element.prototype >> >>> [NoInterfaceObject] >>> interface NodeSelector { >>> Element querySelector(in DOMString selectors, in optional any >>> ... >>> }; >>> Element implements NodeSelector > > Boris Zbarsky: >> This adds a new interface called NodeSelector and says that any >> instance of Element must implement this interface. Right, I get that much, but that mail I linked to previously claimed this difference was somehow observable from scripts, but I don't see how. Since [NoInterfaceObject] means that no script can possibly see whether or not NodeSelector really exists, from a black box perspective I don't see how that has any effect on the implementation. >> But it does not add to Element.prototype; the method goes on the >> mixin prototype object. If that's the case, if the spec uses [NoInterfaceObject] and 'implements', does that mean the spec will disagree with WebKit, Gecko, IE and Opera's implementation of selectors API? AFAICS, all of them expose the querySelector* methods on Element.prototype. See this: http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%0A%3Cscript%3E%0D%0Afor%20(var%20prop%20in%20Element.prototype)%20%7B%0D%0A%20%20if%20(prop%20%3D%3D%20%22querySelector%22%20%7C%7C%20prop%20%3D%3D%20%22querySelectorAll%22)%20w(prop)%0D%0A%7D%0D%0A%3C%2Fscript%3E Check the log at the bottom, where it shows all four browsers find querySelector/querySelectorAll in Element.prototype. >> See http://www.w3.org/TR/WebIDL/#host-object-mixin-prototype > > Boris is right, that’s the difference, as it currently stands in Web IDL > (forgetting for a moment that [Supplemental] isn’t defined). > > What I will do in the near future is implement the proposed changes to remove > multiple inheritance from Web IDL and add the “mixin prototype” concept, > which will allow you to specify the augment-an-existing-prototype > behaviour that [Supplemental] would have given you. OK, what I need to know is before Chaals and I proceed with taking the spec to PR, should I a) wait for you to make these changes and then make whatever relevant IDL changes to Selectors API, or b) just use [NoInterfaceObject] and "foo implements NodeSelector" and publish that? -- Lachlan Hunt - Opera Software http://lachy.id.au/ http://www.opera.com/
Received on Saturday, 2 April 2011 09:46:42 UTC