Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[e] (0) Rearrange how Document objects are initialized and created to…
… make things a little clearer

Affected topics: HTML, HTML Syntax and Parsing

git-svn-id: http://svn.whatwg.org/webapps@8406 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jan 17, 2014
1 parent 782e51e commit 522c6ed
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 68 deletions.
65 changes: 43 additions & 22 deletions complete.html
Expand Up @@ -67153,10 +67153,11 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr
(even if it is empty), then <a href=#scroll-to-fragid title=navigate-fragid>navigate to that fragment
identifier</a> and abort these steps.</li>

<!--CLEANUP-->
<li><p>If <var title="">gone async</var> is false, cancel any preexisting but not yet <a href=#concept-navigate-mature title=concept-navigate-mature>mature</a> attempt to navigate the <a href=#browsing-context>browsing
context</a>, including canceling any instances of the <a href=#fetch>fetch</a> algorithm started by
those attempts. If one of those attempts has already <a href=#create-a-document-object title="create a document
object">created a new <code>Document</code> object</a>, <a href=#abort-a-document title="abort a
those attempts. If one of those attempts has already created and <a href=#initialize-the-document-object title="initialize the document
object">initialized a new <code>Document</code> object</a>, <a href=#abort-a-document title="abort a
document">abort</a> that <code><a href=#document>Document</a></code> also. (Navigation attempts that have <a href=#concept-navigate-mature title=concept-navigate-mature>matured</a> already have session history entries, and are
therefore handled during the <a href=#update-the-session-history-with-the-new-page>update the session history with the new page</a> algorithm,
later.)</li>
Expand Down Expand Up @@ -67427,8 +67428,9 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr
The user agent may indicate to the user that the original page load failed, and that the page
used was a previously cached resource.</p>

<!--CLEANUP-->
<p class=note>This does not affect the <i>address of the resource from which Request-URIs are
obtained</i>, as used to set <a href="#the-document's-referrer">the document's referrer</a> in the <a href=#create-a-document-object>create a Document
obtained</i>, as used to set <a href="#the-document's-referrer">the document's referrer</a> in the <a href=#initialize-the-document-object>initialize the <code>Document</code>
object</a> steps below; they still use the value as computed by the original
<a href=#fetch>fetch</a> algorithm.</p>

Expand Down Expand Up @@ -67461,8 +67463,9 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr
failed, that the page used was a fallback resource, and what the URL of the fallback resource
actually is.</p>

<!--CLEANUP-->
<p class=note>This does not affect the <i>address of the resource from which Request-URIs are
obtained</i>, as used to set <a href="#the-document's-referrer">the document's referrer</a> in the <a href=#create-a-document-object>create a Document
obtained</i>, as used to set <a href="#the-document's-referrer">the document's referrer</a> in the <a href=#initialize-the-document-object>initialize the <code>Document</code>
object</a> steps below; they still use the value as computed by the original
<a href=#fetch>fetch</a> algorithm.</p>

Expand Down Expand Up @@ -67572,9 +67575,9 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr
<p class=note>An <a href=#override-url title="override URL">override URL</a> is set when <a href=#javascript-protocol title="javascript protocol">dereferencing a <code>javascript:</code> URL</a> and when
performing <a href=#an-overridden-reload>an overridden reload</a>.</p>

<p><dfn id=create-a-document-object title="create a Document object">Creating a new <code>Document</code> object</dfn>: when
a <code><a href=#document>Document</a></code> is created as part of the above steps, the user agent must additionally
run the following algorithm as part of creating the new object:</p>
<p><dfn id=initialize-the-document-object title="initialize the Document object">Initializing a new <code>Document</code>
object</dfn>: when a <code><a href=#document>Document</a></code> is created as part of the above steps, the user agent
will be required to additionally run the following algorithm after creating the new object:</p>

<ol><li><p>Create a new <code><a href=#window>Window</a></code> object, and associate it with the
<code><a href=#document>Document</a></code>, with one exception: if the <a href=#browsing-context>browsing context</a>'s only entry in
Expand Down Expand Up @@ -67714,10 +67717,12 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr

<h4 id=read-html><span class=secno>6.6.2 </span><dfn title=navigate-html>Page load processing model for HTML files</dfn></h4>

<!--CLEANUP-->
<p>When an HTML document is to be loaded in a <a href=#browsing-context>browsing context</a>, the user agent must
<a href=#queue-a-task>queue a task</a> to <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being
<a href=#queue-a-task>queue a task</a> to create a <code><a href=#document>Document</a></code> object, mark it as being
an <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to "<code title="">text/html</code>",
create an <a href=#html-parser>HTML parser</a>, and associate it with the document. Each <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a> places on the
<a href=#initialize-the-document-object>initialize the <code>Document</code> object</a>, and finally
create an <a href=#html-parser>HTML parser</a> and associate it with the <code><a href=#document>Document</a></code>. Each <a href=#concept-task title=concept-task>task</a> that the <a href=#networking-task-source>networking task source</a> places on the
<a href=#task-queue>task queue</a> while the <a href=#fetch title=fetch>fetching algorithm</a> runs must then
fill the parser's <a href=#the-input-byte-stream>input byte stream</a> with the fetched bytes and cause the <a href=#html-parser>HTML
parser</a> to perform the appropriate processing of the input stream.</p>
Expand Down Expand Up @@ -67745,9 +67750,16 @@ <h4 id=read-html><span class=secno>6.6.2 </span><dfn title=navigate-html>Page lo

<h4 id=read-xml><span class=secno>6.6.3 </span><dfn title=navigate-xml>Page load processing model for XML files</dfn></h4>

<p>When faced with displaying an XML file inline, user agents must first <a href=#create-a-document-object>create a
<code>Document</code> object</a>, following the requirements of the XML and Namespaces in XML
recommendations, RFC 3023, DOM, and other relevant specifications. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsRFC3023>[RFC3023]</a> <a href=#refsDOM>[DOM]</a></p>
<!--CLEANUP-->
<p>When faced with displaying an XML file inline, user agents must follow the requirements defined
in the XML and Namespaces in XML recommendations, RFC 3023, DOM, and other relevant specifications
to create a <code><a href=#document>Document</a></code> object and a corresponding <a href=#xml-parser>XML parser</a>. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsRFC3023>[RFC3023]</a> <a href=#refsDOM>[DOM]</a></p>

<p class=note>At the time of writing, the XML specification community had not actually yet
specified how XML and the DOM interact.</p> <!--XMLPARSE-->

<p>After the <code><a href=#document>Document</a></code> is created, the user agent must <a href=#initialize-the-document-object>initialize the
<code>Document</code> object</a>.</p>

<p>The actual HTTP headers and other metadata, not the headers as mutated or implied by the
algorithms given in this specification, are the ones that must be used when determining the
Expand Down Expand Up @@ -67789,10 +67801,12 @@ <h4 id=read-xml><span class=secno>6.6.3 </span><dfn title=navigate-xml>Page load

<h4 id=read-text><span class=secno>6.6.4 </span><dfn title=navigate-text>Page load processing model for text files</dfn></h4>

<!--CLEANUP-->
<p>When a plain text document is to be loaded in a <a href=#browsing-context>browsing context</a>, the user agent
must <a href=#queue-a-task>queue a task</a> to <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as
must <a href=#queue-a-task>queue a task</a> to create a <code><a href=#document>Document</a></code> object, mark it as
being an <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to "<code title="">text/plain</code>",
create an <a href=#html-parser>HTML parser</a>, associate it with the document, act as if the tokenizer had
<a href=#initialize-the-document-object>initialize the <code>Document</code> object</a>,
create an <a href=#html-parser>HTML parser</a>, associate it with the <code><a href=#document>Document</a></code>, act as if the tokenizer had
emitted a start tag token with the tag name "pre" followed by a single U+000A LINE FEED (LF)
character<!-- to get eaten, so that a leading LF in the text/plain stream doesn't get eaten
itself-->, and switch the <a href=#html-parser>HTML parser</a>'s tokenizer to the <a href=#plaintext-state>PLAINTEXT
Expand Down Expand Up @@ -67841,10 +67855,11 @@ <h4 id=read-multipart-x-mixed-replace><span class=secno>6.6.5 </span><dfn title=
<a href=#browsing-context>browsing context</a>, the user agent must parse the resource using the rules for
multipart types. <a href=#refsRFC2046>[RFC2046]</a></p>

<!--CLEANUP-->
<p>For each body part obtained from the resource, the user agent must run a new instance of the
<a href=#navigate>navigate</a> algorithm, starting from the <i>resource handling</i> step, using the new
body part as the resource being navigated, with <a href=#replacement-enabled>replacement enabled</a> if a previous
body part from the same resource resulted in a <code><a href=#document>Document</a></code> object being <a href=#create-a-document-object title="create a document object">created</a>, and otherwise using the same setup as the
body part from the same resource resulted in a <code><a href=#document>Document</a></code> object being created and <a href=#initialize-the-document-object title="initialize the document object">initialized</a>, and otherwise using the same setup as the
<a href=#navigate>navigate</a> attempt that caused this section to be invoked in the first place.</p>

<p>For the purposes of algorithms processing these body parts as if they were complete stand-alone
Expand All @@ -67856,9 +67871,11 @@ <h4 id=read-multipart-x-mixed-replace><span class=secno>6.6.5 </span><dfn title=

<h4 id=read-media><span class=secno>6.6.6 </span><dfn title=navigate-media>Page load processing model for media</dfn></h4>

<!--CLEANUP-->
<p>When an image, video, or audio resource is to be loaded in a <a href=#browsing-context>browsing context</a>, the
user agent should <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to the sniffed MIME type of the resource
(<var title="">type</var> in the <a href=#navigate>navigate</a> algorithm), append an <code><a href=#the-html-element>html</a></code>
user agent should create a <code><a href=#document>Document</a></code> object, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to the sniffed MIME type of the resource
(<var title="">type</var> in the <a href=#navigate>navigate</a> algorithm), <a href=#initialize-the-document-object>initialize the
<code>Document</code> object</a>, append an <code><a href=#the-html-element>html</a></code>
element to the <code><a href=#document>Document</a></code>, append a <code><a href=#the-head-element>head</a></code> element and a <code><a href=#the-body-element>body</a></code>
element to the <code><a href=#the-html-element>html</a></code> element, append an element <var title="">host element</var> for
the media, as described below, to the <code><a href=#the-body-element>body</a></code> element, and set the appropriate attribute
Expand Down Expand Up @@ -67898,12 +67915,14 @@ <h4 id=read-media><span class=secno>6.6.6 </span><dfn title=navigate-media>Page

<h4 id=read-plugin><span class=secno>6.6.7 </span><dfn title=navigate-plugin>Page load processing model for content that uses plugins</dfn></h4>

<!--CLEANUP-->
<p>When a resource that requires an external resource to be rendered is to be loaded in a
<a href=#browsing-context>browsing context</a>, the user agent should <a href=#create-a-document-object>create a <code>Document</code>
object</a>, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a> and mark it
<a href=#browsing-context>browsing context</a>, the user agent should create a <code><a href=#document>Document</a></code>
object, mark it as being an <a href=#html-documents title="HTML documents">HTML document</a> and mark it
as being a <dfn id=plugin-document>plugin document</dfn>, set its <a href=#concept-document-content-type title=concept-document-content-type>content
type</a> to the sniffed MIME type of the resource (<var title="">type</var> in the
<a href=#navigate>navigate</a> algorithm), append an <code><a href=#the-html-element>html</a></code> element to the
<a href=#navigate>navigate</a> algorithm),
<a href=#initialize-the-document-object>initialize the <code>Document</code> object</a>, append an <code><a href=#the-html-element>html</a></code> element to the
<code><a href=#document>Document</a></code>, append a <code><a href=#the-head-element>head</a></code> element and a <code><a href=#the-body-element>body</a></code> element to the
<code><a href=#the-html-element>html</a></code> element, append an <code><a href=#the-embed-element>embed</a></code> to the <code><a href=#the-body-element>body</a></code> element, and set
the <code title=attr-embed-src><a href=#attr-embed-src>src</a></code> attribute of the <code><a href=#the-embed-element>embed</a></code> element to the
Expand Down Expand Up @@ -67937,9 +67956,11 @@ <h4 id=read-plugin><span class=secno>6.6.7 </span><dfn title=navigate-plugin>Pag
<h4 id=read-ua-inline><span class=secno>6.6.8 </span><dfn title=navigate-ua-inline>Page load processing model for inline
content that doesn't have a DOM</dfn></h4>

<!--CLEANUP-->
<p>When the user agent is to display a user agent page inline in a <a href=#browsing-context>browsing context</a>,
the user agent should <a href=#create-a-document-object>create a <code>Document</code> object</a>, mark it as being an
the user agent should create a <code><a href=#document>Document</a></code> object, mark it as being an
<a href=#html-documents title="HTML documents">HTML document</a>, set its <a href=#concept-document-content-type title=concept-document-content-type>content type</a> to "<code title="">text/html</code>",
<a href=#initialize-the-document-object>initialize the <code>Document</code> object</a>,
and then either associate that <code><a href=#document>Document</a></code> with a custom rendering that is not rendered
using the normal <code><a href=#document>Document</a></code> rendering rules, or mutate that <code><a href=#document>Document</a></code> until
it represents the content the user agent wants to render.</p>
Expand Down Expand Up @@ -93196,7 +93217,7 @@ <h3 id=parsing-xhtml-documents><span class=secno>13.2 </span>Parsing XHTML docum
the rules given in the XML specification to map a string of bytes or characters into a
<code><a href=#document>Document</a></code> object.</p>

<p class=note>At the time of writing, no such rules actually exist.</p>
<p class=note>At the time of writing, no such rules actually exist.</p><!--XMLPARSE-->

<p>An <a href=#xml-parser>XML parser</a> is either associated with a <code><a href=#document>Document</a></code> object when it is
created, or creates one implicitly.</p>
Expand Down

0 comments on commit 522c6ed

Please sign in to comment.