content/base/test/test_bug339494.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug339494.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<!--
     1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=339494
     1.7 +-->
     1.8 +<head>
     1.9 +  <title>Test for Bug 339494</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 +</head>
    1.13 +<body>
    1.14 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339494">Mozilla Bug 339494</a>
    1.15 +<p id="display"></p>
    1.16 +<div id="content" style="display: none">
    1.17 +  <div id="d" />
    1.18 +  <div id="s" />
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script class="testbody" type="text/javascript">
    1.22 +
    1.23 +/** Test for Bug 339494 **/
    1.24 +
    1.25 +  var d = document.getElementById("d");
    1.26 +  
    1.27 +  d.setAttribute("hhh", "testvalue");
    1.28 +
    1.29 +  document.addEventListener("DOMAttrModified", removeItAgain, false);
    1.30 +  d.removeAttribute("hhh");
    1.31 +  document.removeEventListener("DOMAttrModified", removeItAgain, false);
    1.32 +
    1.33 +  function removeItAgain()
    1.34 +  {
    1.35 +    ok(!d.hasAttribute("hhh"), "Value check 1",
    1.36 +       "There should be no value");
    1.37 +    isnot(d.getAttribute("hhh"), "testvalue", "Value check 2");
    1.38 +    document.removeEventListener("DOMAttrModified", removeItAgain, false);
    1.39 +    d.removeAttribute("hhh");
    1.40 +    ok(true, "Reachability", "We shouldn't have crashed");
    1.41 +  }
    1.42 +  
    1.43 +  var s = document.getElementById("s");
    1.44 +  
    1.45 +  s.setAttribute("ggg", "testvalue");
    1.46 +
    1.47 +  document.addEventListener("DOMAttrModified", compareVal, false);
    1.48 +  s.setAttribute("ggg", "othervalue");
    1.49 +  document.removeEventListener("DOMAttrModified", compareVal, false);
    1.50 +
    1.51 +  function compareVal()
    1.52 +  {
    1.53 +    ok(s.hasAttribute("ggg"), "Value check 3",
    1.54 +       "There should be a value");
    1.55 +    isnot(s.getAttribute("ggg"), "testvalue", "Value check 4");
    1.56 +    is(s.getAttribute("ggg"), "othervalue", "Value check 5");
    1.57 +  }
    1.58 +
    1.59 +</script>
    1.60 +</pre>
    1.61 +</body>
    1.62 +</html>
    1.63 +

mercurial