// retoor <retoor@molodetz.nl>
import "html" for Document
var html = "<div id=\"root\"><p class=\"text first\">One</p><p class=\"text\">Two</p><span>Three</span></div>"
var doc = Document.parse(html)
var byId = doc.getElementById("root")
System.print(byId.tagName) // expect: DIV
var byTag = doc.querySelector("p")
System.print(byTag.textContent) // expect: One
var byClass = doc.querySelector(".text")
System.print(byClass.textContent) // expect: One
var allP = doc.querySelectorAll("p")
System.print(allP.count) // expect: 2
var allText = doc.getElementsByClassName("text")
System.print(allText.count) // expect: 2
var spans = doc.getElementsByTagName("span")
System.print(spans.count) // expect: 1
System.print(spans[0].textContent) // expect: Three
var compound = doc.querySelector("p.text.first")
System.print(compound.textContent) // expect: One
var descendant = doc.querySelector("div p")
System.print(descendant != null) // expect: true
var child = doc.querySelector("div > p")
System.print(child != null) // expect: true