test_bug330705-1.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=330705
  5. -->
  6. <head>
  7. <title>Test for Bug 330705</title>
  8. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  10. <script>
  11. /* variable is true if the element is focused, false otherwise */
  12. var inputFocused = false;
  13. </script>
  14. </head>
  15. <body>
  16. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=330705">Mozilla Bug 330705</a>
  17. <p id="display">
  18. <input onfocus="inputFocused = true" onblur="inputFocused = false" type="text">
  19. <button></button>
  20. </p>
  21. <div id="content" style="display: none">
  22. </div>
  23. <pre id="test">
  24. <script class="testbody" type="text/javascript">
  25. /** Test for Bug 330705 **/
  26. SimpleTest.waitForExplicitFinish();
  27. var isFocused = false;
  28. function onLoad() {
  29. document.getElementsByTagName('input')[0].focus();
  30. document.getElementsByTagName('button')[0].blur();
  31. ok(inputFocused == true, "the input element is still focused after blur() has been called on the unfocused element");
  32. SimpleTest.finish();
  33. }
  34. addLoadEvent(onLoad);
  35. </script>
  36. </pre>
  37. </body>
  38. </html>