|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "html" for Document
|
|
|
|
var doc = Document.parse("<div><p>Text</p></div>")
|
|
|
|
var div = doc.querySelector("div")
|
|
System.print(div.hasChildNodes()) // expect: true
|
|
|
|
var p = doc.querySelector("p")
|
|
System.print(p.hasChildNodes()) // expect: true
|
|
|
|
var empty = doc.createElement("span")
|
|
System.print(empty.hasChildNodes()) // expect: false
|
|
|
|
empty.textContent = "Now has content"
|
|
System.print(empty.hasChildNodes()) // expect: true
|
|
|
|
var emptyDiv = Document.parse("<div></div>")
|
|
System.print(emptyDiv.querySelector("div").hasChildNodes()) // expect: false
|
|
|