<?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>23306</bug_id>
          
          <creation_ts>2013-09-20 17:02:21 +0000</creation_ts>
          <short_desc>[Custom]: Add an ownerDocumentChanged callback</short_desc>
          <delta_ts>2013-09-21 00:10:04 +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>WONTFIX</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>
          
          <blocked>14968</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dominic Cooney">dominicc</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>sorvell</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>93602</commentid>
    <comment_count>0</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-09-20 17:02:21 +0000</bug_when>
    <thetext>Many elements depend on their browsing context. For example, if you were trying to implement a Custom Element that behaves like IMG, the HTML spec opines:

&quot;In a browsing context where scripting is enabled, user agents must obtain images immediately.&quot;

That means it is necessary to observe ownerDocument changes, since the ownerDocument is an element&apos;s link to its browsing context, and moving one of these elements to a new browsing context necessitates some immediate processing step (in this hypothetical case, obtaining images.)

It should be called ownerDocumentChangedCallback since ownerDocument is the name of the DOM property of the element. This callback should take two parameters, documents, the old document and new document.

In the case of moving an element from in the document tree of one browsing context to being in the document tree of another browsing context, the ordering of this callback relative to the entered/left view callbacks should be:

leftViewCallback of the old document
ownerDocumentChangedCallback old document to new document
enteredViewCallback of the new document</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93611</commentid>
    <comment_count>1</comment_count>
    <who name="Steve Orvell">sorvell</who>
    <bug_when>2013-09-20 23:15:08 +0000</bug_when>
    <thetext>I think this callback is not necessary right now. I suggested it as an important platform signal, but upon further reflection, entered/leftView should be sufficient.

For example, when changing documents &lt;img&gt; actually doesn&apos;t obtain images until it enters the document tree (verified on Chrome and Firefox). A quick scan of the blink codebase indicates this concept is used but it&apos;s for pretty arcane reasons that probably won&apos;t come up often for custom elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93612</commentid>
    <comment_count>2</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2013-09-21 00:10:04 +0000</bug_when>
    <thetext>Retracting.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>