OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 <div id="console"></div> |
| 4 |
| 5 <span id="container"></span> |
| 6 <span id="reference"><div></div><span>1,</span><span>2,</span><span>3,</span><di
v></div></span> |
| 7 |
| 8 <script> |
| 9 description('You should see two lines, both with 1,2,3.'); |
| 10 var last; |
| 11 |
| 12 function insert(tagName, id) |
| 13 { |
| 14 last = container.insertBefore(document.createElement(tagName), last); |
| 15 if (id) |
| 16 last.id = id; |
| 17 getComputedStyle(last).color; // attach. |
| 18 return last; |
| 19 } |
| 20 |
| 21 var container = document.getElementById('container'); |
| 22 var div = container.appendChild(document.createElement('div')); |
| 23 getComputedStyle(div).color; // attach. |
| 24 |
| 25 // This inserts the elements in the reverse order they appear in the DOM |
| 26 // calling layout() |
| 27 insert('div'); |
| 28 insert('span', 3).textContent = '3,'; |
| 29 insert('span', 2).textContent = '2,'; |
| 30 insert('span', 1).textContent = '1,'; |
| 31 shouldBeGreaterThanOrEqual("document.getElementById('3').offsetLeft", "docum
ent.getElementById('2').offsetLeft"); |
| 32 shouldBeGreaterThanOrEqual("document.getElementById('2').offsetLeft", "docum
ent.getElementById('1').offsetLeft"); |
| 33 </script> |
OLD | NEW |