<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23170</bug_id>
          
          <creation_ts>2013-09-05 20:20:50 +0000</creation_ts>
          <short_desc>[imports]: Why not have imported documents share their importing document&apos;s defaultView?</short_desc>
          <delta_ts>2014-08-27 17:53:55 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>22864</dependson>
    
    <dependson>24616</dependson>
          <blocked>20683</blocked>
    
    <blocked>23278</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Rafael Weinstein">rafaelw</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>gkrizsanits</cc>
    
    <cc>ian</cc>
    
    <cc>morrita</cc>
    
    <cc>sjmiles</cc>
    
    <cc>sorvell</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>93071</commentid>
    <comment_count>0</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-09-05 20:20:50 +0000</bug_when>
    <thetext></thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93072</commentid>
    <comment_count>1</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-09-05 20:23:14 +0000</bug_when>
    <thetext>HTML Template&apos;s creates the precedent that elements without a defaultView are &quot;inert&quot; (this is colloquial, not specified).

I wonder if it&apos;s more useful separation of concerns that 

HTML Imports: are for importing remote resources (which likely do some registration)

HTML Templates: are for defining fragments of DOM which may be used later.

An an import wishes to declare fragments for later use, it should wrap those fragments in &lt;template&gt;s.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93073</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-09-05 20:25:51 +0000</bug_when>
    <thetext>What about stylesheets, images, videos, and other assets? We need to understand what happens to them. Removing a browsing context for import documents is a nice switch that we happened to use here.

Note, that documents created with implementation.createHTMLDocument also don&apos;t have defaultView (aka browsing context). There&apos;s nothing special about it being absent in HTML templates.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93074</commentid>
    <comment_count>3</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-09-05 20:29:00 +0000</bug_when>
    <thetext>The prior behavior of documents without a defaultView (e.g. created via createHTMLDocument) was the primary motivation for using this as the mechanism of &quot;inertness&quot;. The two are very much related.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93075</commentid>
    <comment_count>4</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-09-05 20:30:31 +0000</bug_when>
    <thetext>Put it this way: If imports have a default view, then all semantics are possible (any element can either be active or inert, depending on what the developer needs). If HTML imports lack a default view, then we&apos;re in the situation of needing to predict what developers will probably want.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93076</commentid>
    <comment_count>5</comment_count>
    <who name="Scott Miles">sjmiles</who>
    <bug_when>2013-09-05 20:33:11 +0000</bug_when>
    <thetext>We will have to think about the various ramifications of this change, but my knee-jerk reaction is that this might be a great simplifier.

To restrict the notion of `inertness` (aka: no defaultView)to templates could clarify several ancillary issues.

&gt; What about stylesheets, images, videos, and other assets

Polymer team wants stylesheets to be &apos;live&apos; as if they were in the main document, would having a proper defaultView in the import make this easier?

As for those other elements, seems like they can do whatever they normally would do. If you don&apos;t want them to do work you should put them in a template.

E.g. this might be a nice way to preload images: shove a bunch of image tags in an import.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93527</commentid>
    <comment_count>6</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-09-18 19:47:03 +0000</bug_when>
    <thetext>*** Bug 21229 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93532</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-09-18 20:05:16 +0000</bug_when>
    <thetext>*** Bug 22864 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94304</commentid>
    <comment_count>8</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-10-04 09:37:09 +0000</bug_when>
    <thetext>Let me confirm my understanding of current consensus:
We&apos;re going to make imports behave like display:none-ed subtree,
which means:

- scripts are loaded and executed
- stylesheets are loaded and become a source of style resolution.
- images are loaded
- nothing is rendered
- it shares document.defaultView with main document

Is this correct?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94311</commentid>
    <comment_count>9</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-10-04 16:53:52 +0000</bug_when>
    <thetext>(In reply to Morrita Hajime from comment #8)
&gt; Let me confirm my understanding of current consensus:
&gt; We&apos;re going to make imports behave like display:none-ed subtree,
&gt; which means:
&gt; 
&gt; - scripts are loaded and executed
&gt; - stylesheets are loaded and become a source of style resolution.
&gt; - images are loaded
&gt; - nothing is rendered
&gt; - it shares document.defaultView with main document
&gt; 
&gt; Is this correct?

That&apos;s how I understand it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94317</commentid>
    <comment_count>10</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-10-04 18:26:04 +0000</bug_when>
    <thetext>sgtm =-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94346</commentid>
    <comment_count>11</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-10-04 22:21:24 +0000</bug_when>
    <thetext>Thanks! I&apos;ll reshape the spec in this way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94451</commentid>
    <comment_count>12</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-10-08 08:59:30 +0000</bug_when>
    <thetext>Thinking a bit more about the implication of this change:

 * 1. Forms become submittable
 * 2. Frames will be loaded
 * 3. Media (audio, video) and plugins are also loaded.

One tricky thing is form submission. It might create another attack vector.
I have no clear idea though. 

Frame could be another complication.
It&apos;s not clear how frame tree should look like for example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103499</commentid>
    <comment_count>13</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2014-04-07 19:54:49 +0000</bug_when>
    <thetext>Moving to future consideration items.

I think what we need here is a way to define the &quot;capacity&quot; of imported document, kind of like CSP.
 
The current import provides fixed set of capacity that allows scripts and stylesheets so far. It is possible to provide a knob to tune this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105921</commentid>
    <comment_count>14</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-05-13 21:49:09 +0000</bug_when>
    <thetext>(In reply to Morrita Hajime from comment #12)
&gt; Thinking a bit more about the implication of this change:
&gt; 
&gt;  * 1. Forms become submittable
&gt;  * 2. Frames will be loaded
&gt;  * 3. Media (audio, video) and plugins are also loaded.

None of these are defined in terms of defaultView.

Forms are submittable if their Document has a browsing context. A browsing context can only have one active document at a time, that&apos;s the one that&apos;s being rendered. It&apos;s the one you get from Window.document.

If we change this and let Windows have multiple &quot;child&quot; Documents, then things are going to get really weird really quickly. For example, window.onload will fire when any of the child Documents finish loading. The Window object&apos;s supported property names would presumably come from all of its child documents, which would lead to all kinds of weird conflicts (e.g. what if two documents have elements with id=&quot;thetop&quot;?). Things like window.location would return... what? The number of things in the platform that assume a 1:1 mapping of Window:Document is high. Just the weirdness around document.open Document reuse and about:blank Window reuse is confusing enough...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106150</commentid>
    <comment_count>15</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2014-05-16 11:10:46 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #14)
&gt; 
&gt; If we change this and let Windows have multiple &quot;child&quot; Documents, then
&gt; things are going to get really weird really quickly.
&gt;
Agreed. This was an attempt to explain how imports work by extending existing
vocabulary of the platform. However it apparently failed.
Another attempt that looks better is to explain it in terms of loading system.

This is orthogonal topic, but we need a way to tell import-loaded document aprt from other inert documents like XHR response. There are no signal other than defaultView so far.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110662</commentid>
    <comment_count>16</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2014-08-27 17:53:55 +0000</bug_when>
    <thetext>Removed the description about defaultView.
https://github.com/w3c/webcomponents/commit/421daec2f6d0735db309ab10fa07fb10d623ea79

Although might want to some signal to decide whether a document is an import eventually, defaultView isn&apos;t good fit for that.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>