content/base/test/test_bug419527.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug419527.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=419527
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 419527</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +  <bindings xmlns="http://www.mozilla.org/xbl"
    1.14 +            xmlns:html="http://www.w3.org/1999/xhtml">
    1.15 +    <binding id="rangebinding">
    1.16 +      <content><html:span>Foo</html:span>
    1.17 +      </content>
    1.18 +      <implementation>
    1.19 +        <constructor>
    1.20 +          var win = XPCNativeWrapper.unwrap(window);
    1.21 +          var span = document.getAnonymousNodes(this)[0];
    1.22 +          win.ok(span.localName == "span", "Wrong anon node!");
    1.23 +          var range = document.createRange();
    1.24 +          range.selectNode(span.firstChild);
    1.25 +          win.ok(range.startContainer == span, "Wrong start container!");
    1.26 +          win.ok(range.endContainer == span, "Wrong end container!");
    1.27 +          var newSubTree = XPCNativeWrapper(win.newSubTree);
    1.28 +          newSubTree.appendChild(this);
    1.29 +          range.setStart(newSubTree.firstChild, 0);
    1.30 +          win.ok(range.startContainer == newSubTree.firstChild,
    1.31 +                 "Range should have been collapsed to newSubTree.firstChild!");
    1.32 +          win.ok(range.endContainer == newSubTree.firstChild,
    1.33 +                 "Range should have been collapsed to newSubTree.firstChild!");
    1.34 +          //XXX This should just call SimpleTest.finish(), bugs 478528, 499735.
    1.35 +          setTimeout(win.finish, 0);
    1.36 +        </constructor>
    1.37 +      </implementation>
    1.38 +    </binding>
    1.39 +  </bindings>
    1.40 +</head>
    1.41 +<body>
    1.42 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=419527">Mozilla Bug 419527</a>
    1.43 +<p id="display"></p>
    1.44 +<div id="content" style="display: none">
    1.45 +  
    1.46 +</div>
    1.47 +<pre id="test">
    1.48 +<script class="testbody" type="text/javascript">
    1.49 +<![CDATA[
    1.50 +
    1.51 +/** Test for Bug 419527 **/
    1.52 +
    1.53 +var d;
    1.54 +
    1.55 +function runRangeTest() {
    1.56 +  window.newSubTree = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
    1.57 +  newSubTree.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "div"));
    1.58 +
    1.59 +  d = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
    1.60 +  d.style.MozBinding = "url('" + window.location + "#rangebinding" + "')";
    1.61 +  document.body.appendChild(d);
    1.62 +}
    1.63 +
    1.64 +function finish() {
    1.65 +  SimpleTest.finish();
    1.66 +}
    1.67 +
    1.68 +SimpleTest.waitForExplicitFinish();
    1.69 +setTimeout(runRangeTest, 0);
    1.70 +
    1.71 +
    1.72 +]]>
    1.73 +</script>
    1.74 +</pre>
    1.75 +</body>
    1.76 +</html>
    1.77 +

mercurial