<?xml version='1.0' encoding='ISO-8859-1'?>         <!-- -*- coding: iso-8859-1; mode: html; -*- -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
    <!-- Copyright 2007, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Textbender Software"), to deal in the Textbender Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Textbender Software, and to permit persons to whom the Textbender Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Textbender Software. THE TEXTBENDER SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TEXTBENDER SOFTWARE OR THE USE OR OTHER DEALINGS IN THE TEXTBENDER SOFTWARE. -->
    <head>
        <title>Selection and Range Level 2 Demonstration</title>
        <link href='_/_.css' rel='stylesheet' type='text/css'/>
        </head>
    <body>
        <h1>Selection and Range Level 2 Demonstration</h1>
        <div class='subtitle'>
            <span class='test-variable'><a href='_/Range_2_Demo.xht_source.txt'>Range_2_Demo.xht_source.txt</a></span> <!-- IE though won't render it as text -->
            <span class='test-variable doctype'>XHTML 1.1</span>
            <span class='test-variable'><a href='_/Range_2_Demo.java'>Range_2_Demo.java</a></span>
            </div>
        <!-- <<< -->

<div class='applet'>
    <script type='text/javascript'>
        if( window.addEventListener ) window.addEventListener // to disable in-memory caching, per http://reluk.ca/project/textbender/o/browser.xht#In-Memory-Caching-and-JSObject
        (
            'unload', function( e ) {}, // do nothing
            /*capture phase*/false
        );
        </script>
    <applet alt='[applet: unsupported by this browser]'
     archive='../../../../rhinohideDemo.jar'
     code='textbender/a/b/rhinohideDemo/_/Range_2_Demo.class'
     MAYSCRIPT='true' width='550' height='90'>
        [applet: unsupported by this browser]
        </applet>
    <div class='boilerplate'>
        requires: <a href='http://java.sun.com/javase/downloads/index.jsp'>Java 1.6</a>
        </div>
    </div>
<p>
    The applet above uses Rhinohide to detect your text selections.
    For each selected range R, it inserts particulars below:
    </p>
<pre>
    R.getCommonAncestorContainer() = <span
id='R-getCommonAncestorContainer' class='altered'> </span>

    R.getStartContainer() = <span
id='R-getStartContainer' class='altered'> </span>
       R.getStartOffset() = <span
   id='R-getStartOffset' class='altered'> </span>
                  R.getCollapsed() = <span
              id='R-getCollapsed' class='altered'> </span>
         R.getEndOffset() = <span
     id='R-getEndOffset' class='altered'> </span>
      R.getEndContainer() = <span
  id='R-getEndContainer' class='altered'> </span>

    R.toString() =</pre><pre
id='R-toString' class='altered' style='background-color:#FFF; height:9em; overflow:auto;'> </pre>
<p>
    When collapsed, the range models a cursor
    (&#x2018;insertion point&#x2019; as the DOM spec calls it).
    You can see this by simply clicking in the text, without selecting anything.
    </p>
<p>
    This implementation polls once a second or so, to discover selection changes.
    An alternative would be to wait for a mouse or key event
    to signal a potential change &mdash; assuming the browser supports events.
    </p>
<p>
    (An interesting loop occurs if you select the entire page.
     Because of positive feedback in the scrollable section (<em>R.toString</em>, above)
     the selection range doubles every second. Eventually something will break... )
    </p>
<table class='test'>
    <tr>
        <th>test host</th> <th>ok</th> <th>details</th>
        </tr>
    <tr><!-- - - - - - - - - - - - - - - - - - - - - - - - - - - -->
        <td class='host'>
            <a
href='http://reluk.ca/system/host/obsidian/linux-build-2007-06.xht#firefox'
     >                                      linux                   firefox</a>
            </td>
        <!--       pass|fail  ok|no -->
        <td class='flag pass'>ok</td>
        <td></td>
        </tr>
    <tr><!-- - - - - - - - - - - - - - - - - - - - - - - - - - - -->
        <td class='host'>
            <a
href='http://reluk.ca/system/host/obsidian/linux-build-2007-06.xht#mozilla'
     >                                      linux                   mozilla</a>
            </td>
        <!--       pass|fail  ok|no -->
        <td class='flag pass'>ok</td>
        <td></td>
        </tr>
    <tr><!-- - - - - - - - - - - - - - - - - - - - - - - - - - - -->
        <td class='host'>
            <a
href='http://reluk.ca/system/host/tinman/windows-update-2007-06.xht#firefox'
     >                                    windows                    firefox</a>
            </td>
        <!--       pass|fail  ok|no -->
        <td class='flag pass'>ok</td>
        <td></td>
        </tr>
    <tr><!-- - - - - - - - - - - - - - - - - - - - - - - - - - - -->
        <td class='host'>
            <a
href='http://reluk.ca/system/host/tinman/windows-update-2007-06.xht#ie'
     >                                    windows                    ie</a>
            </td>
        <!--       pass|fail  ok|no -->
        <td class='flag fail'>no</td>
        <td>DOM range is unsupported by IE7.</td>
        </tr>
    </table>

<!-- >>> -->
        <div class='footer'>
            <div style='float:left; '>
                maintainer <a href='http://reluk.ca/project/textbender-tasks.html'>Michael Allan</a>
                </div>
            <a href='http://reluk.ca/project/textbender/o/rhinohide/'>Rhinohide</a>
            <a href='http://reluk.ca/project/textbender/'><img alt="textbender"
             src='../../../_/logo-light.png' style='border:none; padding:4px; vertical-align:middle; '/></a>
            </div>
        </body>
    </html>