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
+17
@@ -0,0 +1,17 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Document
|
||||
|
||||
var doc = Document.parse("<div><section><p>Deep</p></section></div>")
|
||||
|
||||
System.print(doc.querySelector("div p") != null) // expect: true
|
||||
System.print(doc.querySelector("div section") != null) // expect: true
|
||||
System.print(doc.querySelector("section p") != null) // expect: true
|
||||
System.print(doc.querySelector("div section p") != null) // expect: true
|
||||
|
||||
System.print(doc.querySelector("div span") == null) // expect: true
|
||||
|
||||
var multi = Document.parse("<div><p>A</p><span><p>B</p></span></div>")
|
||||
System.print(multi.querySelectorAll("div p").count) // expect: 2
|
||||
System.print(multi.querySelectorAll("span p").count) // expect: 1
|
||||
|
||||
Reference in New Issue
Block a user