feat: add complete DOM implementation with Document, Element, and NodeList classes to html module
CI / build-linux (push) Successful in 1m39s
CI / build-linux (push) Successful in 1m39s
This commit is contained in:
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Document
|
||||
|
||||
var doc = Document.parse("<div><p>A</p><p>B</p><p>C</p></div>")
|
||||
|
||||
var list = doc.querySelectorAll("p")
|
||||
|
||||
System.print(list.item(0).textContent) // expect: A
|
||||
System.print(list.item(1).textContent) // expect: B
|
||||
System.print(list.item(2).textContent) // expect: C
|
||||
|
||||
System.print(list.item(0).tagName) // expect: P
|
||||
System.print(list.item(1).tagName) // expect: P
|
||||
System.print(list.item(2).tagName) // expect: P
|
||||
|
||||
var single = doc.querySelectorAll("div")
|
||||
System.print(single.item(0).tagName) // expect: DIV
|
||||
|
||||
Reference in New Issue
Block a user