content/base/test/test_bug339494.html

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

mercurial