|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "html" for Document
|
|
|
|
var doc = Document.parse("<div><p>Hello</p><span>World</span></div>")
|
|
|
|
var div = doc.querySelector("div")
|
|
var html = div.innerHTML
|
|
System.print(html.contains("<p>")) // expect: true
|
|
System.print(html.contains("Hello")) // expect: true
|
|
System.print(html.contains("<span>")) // expect: true
|
|
|
|
div.innerHTML = "<a>Link</a>"
|
|
System.print(div.innerHTML.contains("<a>")) // expect: true
|
|
System.print(div.children.count) // expect: 1
|
|
System.print(div.firstChild.tagName) // expect: A
|
|
|
|
var empty = doc.createElement("div")
|
|
System.print(empty.innerHTML) // expect:
|
|
|
|
empty.innerHTML = "Plain text"
|
|
System.print(empty.textContent) // expect: Plain text
|
|
|