Skip to content

Commit

Permalink
the html/head/title/body elements; document.title
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@153 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 17, 2006
1 parent 68b13f0 commit 4f82741
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 53 deletions.
94 changes: 68 additions & 26 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -2242,16 +2242,58 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<!-- XXX see e.g. http://lxr.mozilla.org/seamonkey/source/dom/public/idl/html/nsIDOMNSHTMLDocument.idl -->
};</pre>

<p><dfn id=the-html0>The <code>html</code> element</dfn> of a document is
the root element, if there is one and it's an <code><a
href="#html0">html</a></code> element, or null otherwise.

<p><dfn id=the-head0>The <code>head</code> element</dfn> of a document is
the first <code><a href="#head0">head</a></code> element that is a child
of <a href="#the-html0">the <code>html</code> element</a>, if there is
one, or null otherwise.

<p><dfn id=the-title0>The <code>title</code> element</dfn> of a document is
the first <code><a href="#title2">title</a></code> element that is a child
of <a href="#the-head0">the <code>head</code> element</a>, if there is
one, or null otherwise.

<p><dfn id=the-body0>The <code>body</code> element</dfn> of a document is
the first <code><a href="#body0">body</a></code> element that is a child
of <a href="#the-html0">the <code>html</code> element</a>, if there is
one, or null otherwise. If the <code><a href="#body0">body</a></code>
element is null, then the <code>Document</code> object is the <code><a
href="#body0">body</a></code> element for the purposes of event targetting
(i.e. if an event is to be fired "on <a href="#the-body0">the
<code>body</code> element</a>" when there isn't one, then the event will
instead be fired on the <code>Document</code> object).</p>
<!-- XXX also, document.body might need to point to the first
<frameset> in framed pages -->

<p>The <dfn id=document.title
title=dom-document-title><code>title</code></dfn> attribute must, on
getting, return the...
getting, return a concatenation of the data of all the text node children
of <a href="#the-title0">the <code>title</code> element</a>, or the empty
string if <a href="#the-title0">the <code>title</code> element</a> is
null.

<p class=big-issue>Need to define those members; the <code
title=dom-document-body>body</code> attribute will be used to define <dfn
id=the-body0>the <code title="">body</code> element</dfn>.</p>
<!--
XXX also, document.body might need to point to the first <frameset>
in framed pages -->
<p>On setting, the following algorithm must be run:

<ol>
<li>If <a href="#the-head0">the <code>head</code> element</a> is null,
then the attribute must do nothing. Stop the algorithm here.

<li>If <a href="#the-title0">the <code>title</code> element</a> is null,
then a new <code><a href="#title2">title</a></code> element must be
created and appended to <a href="#the-head0">the <code>head</code>
element</a>.

<li>The children of <a href="#the-title0">the <code>title</code>
element</a> (if any) must all be removed.

<li>A single text node whose data is the new value being assigned must be
appended to <a href="#the-title0">the <code>title</code> element</a>.
</ol>

<p class=big-issue>Need to define those members.</p>
<!-- implied document.open() call when parsing starts, not when
.write() called; xref to parsing section -->

Expand Down Expand Up @@ -4425,14 +4467,17 @@ class="main"> or <div class="content">. Why do we also need a body?
heading. See the section on <a href="#headings1">headings and sections</a>
for further details.

<p>In conforming documents, there is only one <code><a
href="#body0">body</a></code> element. The <code
title=dom-document-body>document.body</code> DOM attribute provides
scripts with easy access to a document's <code><a
href="#body0">body</a></code> element.

<p class=note>Some DOM operations (for example, parts of the <a
href="#drag-and0">drag and drop</a> model) are defined in terms of "<a
href="#the-body0">the <code>body</code> element</a>". See the definition
of the <code title=dom-document-body>document.body</code> DOM attribute
for details.</p>
<!-- XXX define that; check x-refs; ensure "the body
element" is defined even when document.body is null (possibly by
being the root element) -->
href="#the-body0">the <code>body</code> element</a>". This refers to a
particular element in the DOM, as per the definition of the term, and not
any arbitrary <code><a href="#body0">body</a></code> element.

<h4 id=the-section><span class=secno>3.5.2. </span>The <dfn
id=section3><code>section</code></dfn> element</h4>
Expand Down Expand Up @@ -4953,8 +4998,8 @@ XXX attributes to give the date authored, date published
href="#footer0">footer</a></code> element.

<p>To determine the contact information for a sectioning element (such as
the <code><a href="#body0">body</a></code> element, which would give the
contact information for the page), UAs must collect all the <code><a
<a href="#the-body0">the <code>body</code> element</a>, which would give
the contact information for the page), UAs must collect all the <code><a
href="#address0">address</a></code> elements that <a
href="#applyToSection">apply</a> to that sectioning element and its
ancestor sectioning elements. The contact information is the collection of
Expand Down Expand Up @@ -12605,11 +12650,7 @@ XXX selection ranges -->
href="#popstateevent">PopStateEvent</a></code> interface, with the state
object in the <code title=dom-PopStateEvent-state><a
href="#state0">state</a></code> attribute. This event bubbles but is not
cancelable and has no default action.

<p>If there is no "<a href="#the-body0">the <code>body</code> element</a>"
then the event must be fired on the document's <code>Document</code>
object instead.</p>
cancelable and has no default action.</p>
<!-- XXX onpopstate should be defined somewhere -->

<pre
Expand Down Expand Up @@ -12827,9 +12868,7 @@ user reload must be equivalent to .reload()
<p>These events are in the <code>http://www.w3.org/2001/xml-events</code>
namespace, do bubble, are not cancelable, have no default action, and use
the normal <code>Event</code> interface. They must be fired on <a
href="#the-body0">the <code>body</code> element</a>, or, if there isn't a
"<a href="#the-body0">the <code>body</code> element</a>", on the <code><a
href="#htmldocument">HTMLDocument</a></code> object. (As the events
href="#the-body0">the <code>body</code> element</a>. (As the events
bubble, they will reach the <code>Window</code> object.)</p>
<!-- XXX ononline onoffline need to be defined -->

Expand Down Expand Up @@ -14160,7 +14199,11 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
href="#the-body0">the <code>body</code> element</a>, and the <a
href="#current0">current target element</a> must be set to <a
href="#the-body0">the <code>body</code> element</a>, regardless of
whether that event was canceled or not.</p>
whether that event was canceled or not. (If <a href="#the-body0">the
<code>body</code> element</a> is null, then the <a
href="#current0">current target element</a> would be set to null too
in this case, it wouldn't be set to the <code>Document</code>
object.)</p>
</ol>

<li>
Expand Down Expand Up @@ -15913,8 +15956,7 @@ interface <dfn id=storageitem>StorageItem</dfn> {
bubbles, is not cancelable, has no default action, and which uses the
<code><a href="#storageevent">StorageEvent</a></code> interface described
below, must be fired on <a href="#the-body0">the <code>body</code>
element</a>, or, if there isn't one, on the <code><a
href="#htmldocument">HTMLDocument</a></code> object itself.
element</a>.

<p>However, it is possible (indeed, for session storage areas, likely) that
the target <code><a href="#htmldocument">HTMLDocument</a></code> object is
Expand Down
98 changes: 71 additions & 27 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -1305,15 +1305,60 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
<!-- XXX see e.g. http://lxr.mozilla.org/seamonkey/source/dom/public/idl/html/nsIDOMNSHTMLDocument.idl -->
};</pre>

<p><dfn>The <code>html</code> element</dfn> of a document is the
root element, if there is one and it's an <code>html</code> element,
or null otherwise.</p>

<p><dfn>The <code>head</code> element</dfn> of a document is the
first <code>head</code> element that is a child of <span>the
<code>html</code> element</span>, if there is one, or null
otherwise.</p>

<p><dfn>The <code>title</code> element</dfn> of a document is the
first <code>title</code> element that is a child of <span>the
<code>head</code> element</span>, if there is one, or null
otherwise.</p>

<p><dfn>The <code>body</code> element</dfn> of a document is the
first <code>body</code> element that is a child of <span>the
<code>html</code> element</span>, if there is one, or null
otherwise. If the <code>body</code> element is null, then the
<code>Document</code> object is the <code>body</code> element for
the purposes of event targetting (i.e. if an event is to be fired
"on <span>the <code>body</code> element</span>" when there isn't
one, then the event will instead be fired on the
<code>Document</code> object).</p>
<!-- XXX also, document.body might need to point to the first
<frameset> in framed pages -->

<p>The <dfn id="document.title"
title="dom-document-title"><code>title</code></dfn> attribute must,
on getting, return the...</p>
on getting, return a concatenation of the data of all the text node
children of <span>the <code>title</code> element</span>, or the
empty string if <span>the <code>title</code> element</span> is
null.</p>

<p>On setting, the following algorithm must be run:</p>

<ol>

<li>If <span>the <code>head</code> element</span> is null, then the
attribute must do nothing. Stop the algorithm here.</li>

<li>If <span>the <code>title</code> element</span> is null, then a
new <code>title</code> element must be created and appended to
<span>the <code>head</code> element</span>.</li>

<p class="big-issue">Need to define those members; the <code
title="dom-document-body">body</code> attribute will be used to
define <dfn>the <code title="">body</code> element</dfn>.</p> <!--
XXX also, document.body might need to point to the first <frameset>
in framed pages -->
<li>The children of <span>the <code>title</code> element</span> (if
any) must all be removed.</li>

<li>A single text node whose data is the new value being assigned
must be appended to <span>the <code>title</code>
element</span>.</li>

</ol>

<p class="big-issue">Need to define those members.</p>

<!-- implied document.open() call when parsing starts, not when
.write() called; xref to parsing section -->
Expand Down Expand Up @@ -3506,13 +3551,16 @@ class="main"> or <div class="content">. Why do we also need a body?
section on <span>headings and sections</span> for further
details.</p>

<p>In conforming documents, there is only one <code>body</code>
element. The <code title="dom-document-body">document.body</code>
DOM attribute provides scripts with easy access to a document's
<code>body</code> element.</p>

<p class="note">Some DOM operations (for example, parts of the
<span>drag and drop</span> model) are defined in terms of "<span>the
<code>body</code> element</span>". See the definition of the <code
title="dom-document-body">document.body</code> DOM attribute for
details.</p> <!-- XXX define that; check x-refs; ensure "the body
element" is defined even when document.body is null (possibly by
being the root element) -->
<code>body</code> element</span>". This refers to a particular
element in the DOM, as per the definition of the term, and not any
arbitrary <code>body</code> element.</p>


<h4>The <dfn><code>section</code></dfn> element</h4>
Expand Down Expand Up @@ -3936,8 +3984,8 @@ XXX attributes to give the date authored, date published
with other information in a <code>footer</code> element.</p>

<p>To determine the contact information for a sectioning element
(such as the <code>body</code> element, which would give the contact
information for the page), UAs must collect all the
(such as <span>the <code>body</code> element</span>, which would
give the contact information for the page), UAs must collect all the
<code>address</code> elements that <a
href="#applyToSection">apply</a> to that sectioning element and its
ancestor sectioning elements. The contact information is the
Expand Down Expand Up @@ -11156,10 +11204,6 @@ XXX selection ranges -->
<code title="dom-PopStateEvent-state">state</code> attribute. This
event bubbles but is not cancelable and has no default action.</p>

<p>If there is no "<span>the <code>body</code> element</span>" then
the event must be fired on the document's <code>Document</code>
object instead.</p>

<!-- XXX onpopstate should be defined somewhere -->

<pre class="idl">interface <dfn>PopStateEvent</dfn> : Event {
Expand Down Expand Up @@ -11382,9 +11426,7 @@ user reload must be equivalent to .reload()
<code>http://www.w3.org/2001/xml-events</code> namespace, do bubble,
are not cancelable, have no default action, and use the normal
<code>Event</code> interface. They must be fired on <span>the
<code>body</code> element</span>, or, if there isn't a "<span>the
<code>body</code> element</span>", on the
<code>HTMLDocument</code> object. (As the events bubble, they will
<code>body</code> element</span>. (As the events bubble, they will
reach the <code>Window</code> object.)</p>

<!-- XXX ononline onoffline need to be defined -->
Expand Down Expand Up @@ -12685,13 +12727,16 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr

<li>

<p>Otherwise, if the <span>current target element</span> is not
<span>the <code>body</code> element</span>, the user agent must
fire a <code title="event-dragenter">dragenter</code> event at
<span>the <code>body</code> element</span>, and the
<p>Otherwise, if the <span>current target element</span> is
not <span>the <code>body</code> element</span>, the user agent
must fire a <code title="event-dragenter">dragenter</code>
event at <span>the <code>body</code> element</span>, and the
<span>current target element</span> must be set to <span>the
<code>body</code> element</span>, regardless of whether that
event was canceled or not.</p>
event was canceled or not. (If <span>the <code>body</code>
element</span> is null, then the <span>current target
element</span> would be set to null too in this case, it
wouldn't be set to the <code>Document</code> object.)</p>

</li>

Expand Down Expand Up @@ -14426,8 +14471,7 @@ interface <dfn>StorageItem</dfn> {
<code>http://www.w3.org/2001/xml-events</code> namespace, which
bubbles, is not cancelable, has no default action, and which uses
the <code>StorageEvent</code> interface described below, must be
fired on <span>the <code>body</code> element</span>, or, if there
isn't one, on the <code>HTMLDocument</code> object itself.</p>
fired on <span>the <code>body</code> element</span>.</p>

<p>However, it is possible (indeed, for session storage areas,
likely) that the target <code>HTMLDocument</code> object is not
Expand Down

0 comments on commit 4f82741

Please sign in to comment.