[Bug 21066] New: [Shadow]: Provide an event path api

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

            Bug ID: 21066
           Summary: [Shadow]: Provide an event path api
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
          Assignee: dglazkov@chromium.org
          Reporter: sorvell@chromium.org
        QA Contact: public-webapps-bugzilla@w3.org
            Blocks: 14978

It's a common practice to install an event listener on some ancestor node and
interrogate the event target to discover some intermediate node of importance
on which the event occurred. It's possible to install listeners on each of the
intermediate nodes, but it's not efficient to do so.

Consider this setup: in a chess game, there's a <table> representing the board.
Each cell can contain a piece and we need to know when the user clicks on a
cell.  Instead of installing a click event listener on each of the 64 cells, we
install one listener on the board <table> itself. The event target might be a
piece and we crawl up the dom tree to find the cell that was clicked.

There's a problem with this approach when using shadowDOM. There is no
convenient way in general to take an event target and crawl up the tree if
doing so needs to traverse into shadowDOM. For example, let's imagine that the
chess pieces are in the game element's light DOM and the board cells are in its
shadowDOM. In this case event.target.parentNode will be the board itself so we
cannot easily discover which cell was clicked.

One way to solve this problem is to provide an api for discovering the path of
an event through a shadowRoot. This might return a node list of effective
parents in the composed dom tree. For example, shadowRoot.pathForEvent(e) would
in this case return: [e.target, cell, table, game's shadowRoot].

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 21 February 2013 02:29:09 UTC