test_bug629801.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=629801
  5. -->
  6. <head>
  7. <title>Test for Bug 629801</title>
  8. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <script type="application/javascript" src="reflect.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=629801">Mozilla Bug 629801</a>
  14. <p id="display"></p>
  15. <div id="content" style="display: none">
  16. <div itemscope>
  17. This tests itemValue on time elements, first with no datetime attribute, then with no text content,
  18. then with both.
  19. <time id="t1" itemprop="a">May 10th 2009</time>
  20. <time id="t2" itemprop="b" datetime="2009-05-10"></time>
  21. <time id="t3" itemprop="c" datetime="2009-05-10">May 10th 2009</time>
  22. </div>
  23. </div>
  24. <pre id="test">
  25. <script type="application/javascript">
  26. /** Test for Bug 629801 **/
  27. var t1 = document.getElementById("t1"),
  28. t2 = document.getElementById("t2"),
  29. t3 = document.getElementById("t3"),
  30. t4 = document.createElement("time");
  31. // .dateTime IDL
  32. is(t1.dateTime, "", "dateTime is properly set to empty string if datetime attributeis absent");
  33. is(t2.dateTime, "2009-05-10", "dateTime is properly set to datetime attribute with datetime and no text content");
  34. is(t3.dateTime, "2009-05-10", "dateTime is properly set to datetime attribute with datetime and text content");
  35. // dateTime reflects datetime attribute
  36. reflectString({
  37. element: t4,
  38. attribute: "dateTime"
  39. });
  40. </script>
  41. </pre>
  42. </body>
  43. </html>