content/base/test/chrome/test_bug683852.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
     4 <!--
     5 https://bugzilla.mozilla.org/show_bug.cgi?id=683852
     6 -->
     7 <window title="Mozilla Bug 683852"
     8         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    10   <button value="testbutton" id="testbutton"/>
    11   <!-- test results are displayed in the html:body -->
    12   <body xmlns="http://www.w3.org/1999/xhtml">
    13   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=683852"
    14      target="_blank" id="link">Mozilla Bug 683852</a>
    15   </body>
    17   <!-- test code goes here -->
    18   <script type="application/javascript">
    19   <![CDATA[
    20   /** Test for Bug 683852 **/
    21   SimpleTest.waitForExplicitFinish();
    23   function startTest() {
    24     is(document.contains(document), true, "Document should contain itself!");
    26     var tb = document.getElementById("testbutton");
    27     is(document.contains(tb), true, "Document should contain element in it!");
    28     is(tb.contains(tb), true, "Element should contain itself.")
    29     var anon = document.getAnonymousElementByAttribute(tb, "anonid", "button-box");
    30     is(document.contains(anon), false, "Document should not contain anonymous element in it!");
    31     is(tb.contains(anon), false, "Element should not contain anonymous element in it!");
    32     is(anon.contains(anon), true, "Anonymous element should contain itself.")
    33     is(document.documentElement.contains(tb), true, "Element should contain element in it!");
    34     is(document.contains(document.createElement("foo")), false, "Document shouldn't contain element which is't in the document");
    35     is(document.contains(document.createTextNode("foo")), false, "Document shouldn't contain text node which is't in the document");
    37     var link = document.getElementById("link");
    38     is(document.contains(link.firstChild), true,
    39        "Document should contain a text node in it.");
    40     is(link.contains(link.firstChild), true,
    41        "Element should contain a text node in it.");
    42     is(link.firstChild.contains(link), false, "text node shouldn't contain its parent.");
    44     is(document.contains(null), false, "Document shouldn't contain null.");
    46     var pi = document.createProcessingInstruction("adf", "asd");
    47     is(pi.contains(document), false, "Processing instruction shouldn't contain document");
    48     document.documentElement.appendChild(pi);
    49     document.contains(pi, true, "Document should contain processing instruction");
    51     var df = document.createRange().createContextualFragment("<div>foo</div>");
    52     is(df.contains(df.firstChild), true, "Document fragment should contain its child");
    53     is(df.contains(df.firstChild.firstChild), true,
    54        "Document fragment should contain its descendant");
    55     is(df.contains(df), true, "Document fragment should contain itself.");
    57     var d = document.implementation.createHTMLDocument("");
    58     is(document.contains(d), false,
    59        "Document shouldn't contain another document.");
    60     is(document.contains(d.createElement("div")), false,
    61        "Document shouldn't contain an element from another document.");
    63     SimpleTest.finish();
    64   }
    66   addLoadEvent(startTest);
    67   ]]>
    68   </script>
    69 </window>

mercurial