[Bug 18429] New: [Shadow]: Specify imperative API for node distribution

https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429

           Summary: [Shadow]: Specify imperative API for node distribution
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
        AssignedTo: dglazkov@chromium.org
        ReportedBy: dglazkov@chromium.org
         QAContact: public-webapps-bugzilla@w3.org
                CC: tross@microsoft.com, travil@microsoft.com,
                    shinyak@chromium.org, hayato@chromium.org
            Blocks: 18428


Declarative insertion points syntax is not able to address several use cases
(spec bugs to be filed by Hayato-san and Shinya-san). Here's a strawman for an
imperative API:

The general idea is that the insertion point distribution is actually something
that occurs as a result of running some function/callback. The callback could
be powered with Mutation Observers, or some internal implementation. When this
function runs, it operates on a special API of HTMLContentElement: the
distributedChildren (name TBD) array.

Adding a Node to this array makes it appear projected into its
HTMLContentElement. If a node is not a descendant of shadow host, an exception
is thrown. If a node is a descendant of another node that is already a member
of any distributedChildren array of the shadow subtree, that other node is
ejected from the distributedChildren array to which it belonged. There are more
cases to handle, but you get the gist.

The declarative API is simply a byproduct of some default function/callback.
You can override this callback with your custom handler, thus disabling the
declarative API.

The advantage here is that you can:

1) completely explain the magic of the declarative insertion point syntax

2) provide solutions to all of the use cases (including crazy stuff like
dynamic creation of insertion points for varying number of children)

The disadvantage is that:

1) the API has tremendous foot-gun potential and we need to make darn sure to
steer clear of those.

2) there are potential challenges with making this work in a performant
fashion.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 27 July 2012 22:19:35 UTC