Skip to content

Commit

Permalink
Add constructor for Range.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anne van Kesteren committed Feb 11, 2013
1 parent a2f1e18 commit cac920a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 29 deletions.
34 changes: 20 additions & 14 deletions Overview.src.html
Expand Up @@ -4415,23 +4415,18 @@ <h3>Interface <code>Document</code></h3>
<var title>event</var> interface and return it.
</ol>

<p class="note">This method is pretty much obsolete as
<span title=concept-event>events</span> have constructors these days, but
needs to be supported for legacy content. Tough.
<p class="note"><span title=concept-event>Event</span> constructors can be used instead.

<hr>

<dl class=domintro>
<dt><var title>event</var> = <var title>document</var> . <code title=dom-Document-createRange>createRange()</code>
<dd><p>Returns a new <span title=concept-range>range</span>.
</dl>

<p>The <dfn title=dom-Document-createRange><code>createRange()</code></dfn>
method must return a new <span title=concept-range>range</span> with
(<span>context object</span>, 0) as its
<span title=concept-range-start>start</span> and
<span title=concept-range-end>end</span>.

<p class=note>The <code title=dom-Range>Range()</code> constructor can be used instead.

<hr>

<p>The
Expand Down Expand Up @@ -5965,7 +5960,7 @@ <h3>Introduction to "DOM Ranges"</h3>
<var title>em</var> to the <code>em</code>
<span title=concept-element>element</span>, this would be done as follows:

<pre><code>var range = document.createRange(),
<pre><code>var range = new Range(),
firstText = p.childNodes[1],
secondText = em.firstChild
range.setStart(firstText, 9) // do not forget the leading space
Expand Down Expand Up @@ -5997,7 +5992,8 @@ <h3>Introduction to "DOM Ranges"</h3>


<h3>Interface <code>Range</code></h3>
<pre class=idl>interface <dfn>Range</dfn> {
<pre class=idl>[<span title=dom-Range>Constructor</span>]
interface <dfn>Range</dfn> {
readonly attribute <span>Node</span> <span title=dom-Range-startContainer>startContainer</span>;
readonly attribute unsigned long <span title=dom-Range-startOffset>startOffset</span>;
readonly attribute <span>Node</span> <span title=dom-Range-endContainer>endContainer</span>;
Expand Down Expand Up @@ -6041,9 +6037,6 @@ <h3>Interface <code>Range</code></h3>
<p><code>Range</code> objects are simply known as
<dfn title=concept-range>ranges</dfn>.

<p class=note><span title=concept-range>Ranges</span> can be created using
the <code title=dom-Document-createRange>createRange()</code> method.

<p>A <dfn title=concept-range-bp>boundary point</dfn> is a
(<span title=concept-node>node</span>,
<dfn title=concept-range-bp-offset>offset</dfn>) tuple, where
Expand Down Expand Up @@ -6241,6 +6234,19 @@ <h3>Interface <code>Range</code></h3>

<hr>

<dl class=domintro>
<dt><code><var title>range</var> = new <span title=dom-Range>Range</span>()</code>
<dd><p>Returns a new <span title=concept-range>range</span>.
</dl>

<p>The <dfn title=dom-Range><code>Range()</code></dfn> constructor must return a new
<span title=concept-range>range</span> with
(global object's associated <span title=concept-document>document</span>, 0) as its
<span title=concept-range-start>start</span> and
<span title=concept-range-end>end</span>.

<hr>

<dl class=domintro>
<dt><var title>node</var> = <var title>range</var> . <code title=dom-Range-startContainer>startContainer</code>
<dd><p>Returns <var title>range</var>'s
Expand Down Expand Up @@ -8883,7 +8889,7 @@ <h3>DOM Core</h3>
</ul>
</dl>

<h3>DOM Range</h3>
<h3>DOM Ranges</h3>

<p>These are the changes made to the features described in the
"Document Object Model Range" chapter of
Expand Down
36 changes: 21 additions & 15 deletions dom-core.html
Expand Up @@ -137,7 +137,7 @@ <h2 class="no-num no-toc" id="table-of-contents">Table of Contents</h2>
<ol>
<li><a href="#dom-events"><span class="secno">10.1 </span>DOM Events</a></li>
<li><a href="#dom-core"><span class="secno">10.2 </span>DOM Core</a></li>
<li><a href="#dom-range"><span class="secno">10.3 </span>DOM Range</a></li>
<li><a href="#dom-ranges"><span class="secno">10.3 </span>DOM Ranges</a></li>
<li><a href="#dom-traversal"><span class="secno">10.4 </span>DOM Traversal</a></ol></li>
<li><a class="no-num" href="#references">References</a></li>
<li><a class="no-num" href="#acknowledgments">Acknowledgments</a></ol>
Expand Down Expand Up @@ -4483,23 +4483,18 @@ <h3 id="interface-document"><span class="secno">5.5 </span>Interface <code><a hr
<var title="">event</var> interface and return it.
</ol>

<p class="note">This method is pretty much obsolete as
<a href="#concept-event" title="concept-event">events</a> have constructors these days, but
needs to be supported for legacy content. Tough.
<p class="note"><a href="#concept-event" title="concept-event">Event</a> constructors can be used instead.

<hr>

<dl class="domintro">
<dt><var title="">event</var> = <var title="">document</var> . <code title="dom-Document-createRange"><a href="#dom-document-createrange">createRange()</a></code>
<dd><p>Returns a new <a href="#concept-range" title="concept-range">range</a>.
</dl>

<p>The <dfn id="dom-document-createrange" title="dom-Document-createRange"><code>createRange()</code></dfn>
method must return a new <a href="#concept-range" title="concept-range">range</a> with
(<a href="#context-object">context object</a>, 0) as its
<a href="#concept-range-start" title="concept-range-start">start</a> and
<a href="#concept-range-end" title="concept-range-end">end</a>.

<p class="note">The <code title="dom-Range"><a href="#dom-range">Range()</a></code> constructor can be used instead.

<hr>

<p>The
Expand Down Expand Up @@ -6023,7 +6018,7 @@ <h3 id="introduction-to-dom-ranges"><span class="secno">6.1 </span>Introduction
<var title="">em</var> to the <code>em</code>
<a href="#concept-element" title="concept-element">element</a>, this would be done as follows:

<pre><code>var range = document.createRange(),
<pre><code>var range = new Range(),
firstText = p.childNodes[1],
secondText = em.firstChild
range.setStart(firstText, 9) // do not forget the leading space
Expand Down Expand Up @@ -6055,7 +6050,8 @@ <h3 id="introduction-to-dom-ranges"><span class="secno">6.1 </span>Introduction


<h3 id="interface-range"><span class="secno">6.2 </span>Interface <code><a href="#range">Range</a></code></h3>
<pre class="idl">interface <dfn id="range">Range</dfn> {
<pre class="idl">[<a href="#dom-range" title="dom-Range">Constructor</a>]
interface <dfn id="range">Range</dfn> {
readonly attribute <a href="#node">Node</a> <a href="#dom-range-startcontainer" title="dom-Range-startContainer">startContainer</a>;
readonly attribute unsigned long <a href="#dom-range-startoffset" title="dom-Range-startOffset">startOffset</a>;
readonly attribute <a href="#node">Node</a> <a href="#dom-range-endcontainer" title="dom-Range-endContainer">endContainer</a>;
Expand Down Expand Up @@ -6099,9 +6095,6 @@ <h3 id="interface-range"><span class="secno">6.2 </span>Interface <code><a href=
<p><code><a href="#range">Range</a></code> objects are simply known as
<dfn id="concept-range" title="concept-range">ranges</dfn>.

<p class="note"><a href="#concept-range" title="concept-range">Ranges</a> can be created using
the <code title="dom-Document-createRange"><a href="#dom-document-createrange">createRange()</a></code> method.

<p>A <dfn id="concept-range-bp" title="concept-range-bp">boundary point</dfn> is a
(<a href="#concept-node" title="concept-node">node</a>,
<dfn id="concept-range-bp-offset" title="concept-range-bp-offset">offset</dfn>) tuple, where
Expand Down Expand Up @@ -6299,6 +6292,19 @@ <h3 id="interface-range"><span class="secno">6.2 </span>Interface <code><a href=

<hr>

<dl class="domintro">
<dt><code><var title="">range</var> = new <a href="#dom-range" title="dom-Range">Range</a>()</code>
<dd><p>Returns a new <a href="#concept-range" title="concept-range">range</a>.
</dl>

<p>The <dfn id="dom-range" title="dom-Range"><code>Range()</code></dfn> constructor must return a new
<a href="#concept-range" title="concept-range">range</a> with
(global object's associated <a href="#concept-document" title="concept-document">document</a>, 0) as its
<a href="#concept-range-start" title="concept-range-start">start</a> and
<a href="#concept-range-end" title="concept-range-end">end</a>.

<hr>

<dl class="domintro">
<dt><var title="">node</var> = <var title="">range</var> . <code title="dom-Range-startContainer"><a href="#dom-range-startcontainer">startContainer</a></code>
<dd><p>Returns <var title="">range</var>'s
Expand Down Expand Up @@ -8909,7 +8915,7 @@ <h3 id="dom-core"><span class="secno">10.2 </span>DOM Core</h3>
</ul>
</dl>

<h3 id="dom-range"><span class="secno">10.3 </span>DOM Range</h3>
<h3 id="dom-ranges"><span class="secno">10.3 </span>DOM Ranges</h3>

<p>These are the changes made to the features described in the
"Document Object Model Range" chapter of
Expand Down

0 comments on commit cac920a

Please sign in to comment.