Html程序  |  67行  |  1.78 KB

<html>
<head>
<title>Highlighting preformatted text after tab</title>
<style type="text/css">
#t4 { font-size: 36px; }
#t4:first-line { font-size:16px; }
</style>
<script type="text/javascript">
function test1()
{
    var t = document.getElementById('t1').childNodes[1];
    window.getSelection().setBaseAndExtent(t, 1, t, 13);
}

function test2()
{
    var t = document.getElementById('t2').childNodes[0];
    window.getSelection().setBaseAndExtent(t, 5, t, 23);
}

function test3()
{
    var t = document.getElementById('t3').childNodes[0];
    window.getSelection().setBaseAndExtent(t, 5, t, 23);
}

function test4()
{
    var t = document.getElementById('t4').childNodes[0];
    window.getSelection().setBaseAndExtent(t, 11, t, 29);
}
</script>
</head>
<body>
<p>
This is a test for <i>http://bugs.webkit.org/show_bug.cgi?id=6043
Incorrect selection highlighting in pre-formatted text with tabs</i>.
</p>
<hr>
<p>
Instructions:
</p>
<p>
1. Click <a href="#" onclick="window.setTimeout(test1,1);">test 1</a>.
The entire word &ldquo;highlighting&rdquo; below should be highlighted.
</p>
<pre id="t1"><span>Buggy</span>	highlighting</pre>
<p>
2. Click <a href="#" onclick="window.setTimeout(test2,1);">test 2</a>.
The words &ldquo;buggy highlighting&rdquo; below should be fully highlighted.
</p>
<pre id="t2" style="padding-left: 10px;">Very buggy	highlighting</pre>
<p>
3. Click <a href="#" onclick="window.setTimeout(test3,1);">test 3</a>.
The words &ldquo;buggy highlighting&rdquo; below should be fully highlighted.
</p>
<pre id="t3" style="margin-left: 10px;">Very buggy	highlighting</pre>
<p>
4. Click <a href="#" onclick="window.setTimeout(test4,1);">test 4</a>.
The words &ldquo;buggy highlighting&rdquo; below should be fully highlighted.
</p>
<p id="t4">
Even more buggy highlighting.
</p>
</body>
</html>