W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: Component Model: Landing Experimental Shadow DOM API in WebKit

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 30 Jun 2011 10:28:27 +1200
To: Dimitri Glazkov <dglazkov@chromium.org>
Cc: Anne van Kesteren <annevk@opera.com>, Boris Zbarsky <bzbarsky@mit.edu>, public-webapps@w3.org
Message-ID: <20110629222827.GA31240@wok.mcc.id.au>
Anne van Kesteren:
> > How can Document inherit from TreeScope if it already inherits from Node?

Dimitri Glazkov:
> TreeScope is a Node.

That doesn’t work now that Web IDL allows only single inheritance.

Here is how I would write the IDL, if I understand what you want
correctly:

  // augment Element with these two attributes
  partial interface Element {
    attribute ShadowRoot shadow setraises(DOMException);
    attribute String pseudo;
  };

  // a mixin
  [NoInterfaceObject]
  interface TreeScope {
    readonly TreeScope parentTreeScope;
    Element getElementById(in DOMString elementId);
  };

  // ShadowRoot is a new type of Node
  interface ShadowRoot : Node {
    attribute bool applyAuthorSheets;
    readonly attribute Element shadowHost;
  };
  // which has TreeScope functionality
  ShadowRoot implements TreeScope;

  // augment Document with createShadow()
  partial interface Document {
    ShadowRoot createShadow();
  };

  // Documents also have TreeScope functioanlity
  Document implements TreeScope;

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Wednesday, 29 June 2011 22:29:41 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:45 GMT