description('Various tests for the section element.'); var testParent = document.createElement('div'); document.body.appendChild(testParent); debug('<section> closes <p>:'); testParent.innerHTML = '

Test that

a section element
closes <p>.

'; var section1 = document.getElementById('section1'); shouldBeFalse('section1.parentNode.nodeName == "p"'); debug('<p> does not close <section>:'); testParent.innerHTML = '
Test that

a p element

does not close a section element.
'; var p1 = document.getElementById('p1'); shouldBe('p1.parentNode.nodeName', '"SECTION"'); debug('<section> can be nested inside <section>:'); testParent.innerHTML = '
Test that
a section element
can be nested inside another.
'; var section3 = document.getElementById('section3'); shouldBe('section3.parentNode.id', '"section2"'); debug('Residual style:'); testParent.innerHTML = '
This text should be bold.
This is also bold.
'; function getWeight(id) { return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('font-weight'); } shouldBe('getWeight("section4")', '"bold"'); shouldBe('getWeight("span1")', '"bold"'); document.body.removeChild(testParent); debug('FormatBlock:'); var editable = document.createElement('div'); editable.innerHTML = '[The text will be a child of <section>.]'; document.body.appendChild(editable); editable.contentEditable = true; var selection = window.getSelection(); selection.selectAllChildren(editable); document.execCommand('FormatBlock', false, 'section'); selection.removeAllRanges(); shouldBe('document.getElementById("span2").parentNode.nodeName', '"SECTION"'); document.body.removeChild(editable);