[Bug 21976] [imports]: Preventing DOM hierarchy cycles

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

--- Comment #5 from Rafael Weinstein <rafaelw@chromium.org> ---
I'd explain this by analogy to the template element.

Consider

<div id=a>
  <template>
    <div id=b>

If we parse this, we need a way to prevent a cycle (for example by appending
divA as a child to divB).

The way we accomplish this is that the templates content document fragment has
a (non-exposed) |host| pointer which points at its host (the template element)
--- and we have append/insert check that the host-including-inclusive-ancestor,
which traverse this host link to check for a cycle.

Now consider the what would happen if a single document fragment would be
shared among template elements: What does its |host| point to? It has multiple
"hosts"? Does append/insert have to traverse all of them?

Because HTML imports allows multiple link.document pointers to point to the
same document, we have this later case. Now consider something like

<div id=a>
  <link rel="import" href="a.html">
  <link rel="import" href="a.html">

----a.html----
<div id=b>

How to prevent a cycle by attempting to append divA as a child of divB (which
is a child of a document which is pointed to by both link.documents.

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

Received on Monday, 19 August 2013 17:53:06 UTC