content/base/test/test_bug330925.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug330925.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<!--
     1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=330925
     1.7 +-->
     1.8 +<head>
     1.9 +  <title>Test for Bug 330925</title>
    1.10 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.11 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.12 +
    1.13 +<style type="text/css">
    1.14 +#t {
    1.15 +-moz-binding: url(#randomxbl);
    1.16 +}
    1.17 +</style>
    1.18 +
    1.19 +<bindings xmlns="http://www.mozilla.org/xbl">
    1.20 +<binding id="randomxbl" inheritstyle="false">
    1.21 +<content>
    1.22 +xbl textnode1
    1.23 +<div>
    1.24 +xbl textnode2
    1.25 +<children xmlns="http://www.mozilla.org/xbl"/>
    1.26 +</div>
    1.27 +</content>
    1.28 +</binding>
    1.29 +</bindings>
    1.30 +
    1.31 +</head>
    1.32 +<body>
    1.33 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=330925">Mozilla Bug 330925</a>
    1.34 +
    1.35 +<p id="display">
    1.36 +<div id="t" />
    1.37 +</p>
    1.38 +
    1.39 +<pre id="test">
    1.40 +<script class="testbody" type="text/javascript">
    1.41 +<![CDATA[
    1.42 +
    1.43 +/** Test for Bug 330925 **/
    1.44 +
    1.45 +// We have to wait until onload because XBL doesn't bind immediately.
    1.46 +SimpleTest.waitForExplicitFinish();
    1.47 +addLoadEvent(init);
    1.48 +
    1.49 +function init()
    1.50 +{
    1.51 +  var t = document.getElementById("t");
    1.52 +  var d = SpecialPowers.wrap(document);
    1.53 +
    1.54 +  is(SpecialPowers.unwrap(d.getBindingParent(d.getAnonymousNodes(t)[0])),
    1.55 +     t,
    1.56 +     "Wrong binding parent for anonymous node");
    1.57 +     
    1.58 +  is(SpecialPowers.unwrap(d.getBindingParent(d.getAnonymousNodes(t)[1].childNodes[0])),
    1.59 +     t,
    1.60 +     "Wrong binding parent for child of anonymous node");
    1.61 +     
    1.62 +  is(d.getBindingParent(t), 
    1.63 +     null,
    1.64 +     "Non-anonymous node should not have a binding parent");
    1.65 +     
    1.66 +  is(d.getBindingParent(document.documentElement), 
    1.67 +     null,
    1.68 +     "Document element should not have a binding parent");
    1.69 +     
    1.70 +  SimpleTest.finish();
    1.71 +}
    1.72 +
    1.73 +]]>
    1.74 +</script>
    1.75 +</pre>
    1.76 +</body>
    1.77 +</html>

mercurial