|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "html" for Document
|
|
|
|
var doc = Document.parse("<div id='container'></div>")
|
|
|
|
var p = doc.createElement("p")
|
|
System.print(p != null) // expect: true
|
|
System.print(p.tagName) // expect: P
|
|
|
|
var span = doc.createElement("span")
|
|
System.print(span.tagName) // expect: SPAN
|
|
|
|
var div = doc.createElement("div")
|
|
System.print(div.tagName) // expect: DIV
|
|
|
|
p.textContent = "New paragraph"
|
|
System.print(p.textContent) // expect: New paragraph
|
|
|
|
var container = doc.getElementById("container")
|
|
container.appendChild(p)
|
|
System.print(container.children.count) // expect: 1
|
|
System.print(container.firstChild.tagName) // expect: P
|
|
|