| OLD | NEW |
| (Empty) |
| 1 description('Various tests for the article element.'); | |
| 2 | |
| 3 var testParent = document.createElement('div'); | |
| 4 document.body.appendChild(testParent); | |
| 5 | |
| 6 debug('<article> closes <p>:'); | |
| 7 testParent.innerHTML = '<p>Test that <article id="article1">an article element</
article> closes <p>.</p>'; | |
| 8 var article1 = document.getElementById('article1'); | |
| 9 shouldBeFalse('article1.parentNode.nodeName == "p"'); | |
| 10 | |
| 11 debug('<p> does not close <article>:'); | |
| 12 testParent.innerHTML = '<article>Test that <p id="p1">a p element</p> does not c
lose an article element.</article>'; | |
| 13 var p1 = document.getElementById('p1'); | |
| 14 shouldBe('p1.parentNode.nodeName', '"ARTICLE"'); | |
| 15 | |
| 16 debug('<article> can be nested inside <article>:'); | |
| 17 testParent.innerHTML = '<article id="article2">Test that <article id="article3">
an article element</article> can be nested inside another.</article>'; | |
| 18 var article3 = document.getElementById('article3'); | |
| 19 shouldBe('article3.parentNode.id', '"article2"'); | |
| 20 | |
| 21 debug('Residual style:'); | |
| 22 testParent.innerHTML = '<b><article id="article4">This text should be bold.</art
icle> <span id="span1">This is also bold.</span></b>'; | |
| 23 function getWeight(id) { | |
| 24 return document.defaultView.getComputedStyle(document.getElementById(id), nu
ll).getPropertyValue('font-weight'); | |
| 25 } | |
| 26 shouldBe('getWeight("article4")', '"bold"'); | |
| 27 shouldBe('getWeight("span1")', '"bold"'); | |
| 28 document.body.removeChild(testParent); | |
| 29 | |
| 30 debug('FormatBlock:'); | |
| 31 var editable = document.createElement('div'); | |
| 32 editable.innerHTML = '[<span id="span2">The text will be a child of <article>
.</span>]'; | |
| 33 document.body.appendChild(editable); | |
| 34 editable.contentEditable = true; | |
| 35 var selection = window.getSelection(); | |
| 36 selection.selectAllChildren(editable); | |
| 37 document.execCommand('FormatBlock', false, 'article'); | |
| 38 selection.removeAllRanges(); | |
| 39 shouldBe('document.getElementById("span2").parentNode.nodeName', '"ARTICLE"'); | |
| 40 document.body.removeChild(editable); | |
| 41 | |
| OLD | NEW |