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:
+15
@@ -0,0 +1,15 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Document
|
||||
|
||||
var doc = Document.parse("<ul><li>A</li><li>B</li><li>C</li></ul>")
|
||||
|
||||
System.print(doc.querySelector("li:last-child") != null) // expect: true
|
||||
System.print(doc.querySelector("li:last-child").textContent) // expect: C
|
||||
|
||||
var multi = Document.parse("<div><p>First</p><span>Last</span></div>")
|
||||
System.print(multi.querySelector("span:last-child") != null) // expect: true
|
||||
System.print(multi.querySelector("span:last-child").textContent) // expect: Last
|
||||
|
||||
System.print(multi.querySelector("p:last-child") == null) // expect: true
|
||||
|
||||
Reference in New Issue
Block a user