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:
+17
@@ -0,0 +1,17 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Document
|
||||
|
||||
var doc = Document.parse("<ul><li>A</li><li>B</li><li>C</li><li>D</li><li>E</li></ul>")
|
||||
|
||||
System.print(doc.querySelector("li:nth-child(1)") != null) // expect: true
|
||||
System.print(doc.querySelector("li:nth-child(1)").textContent) // expect: A
|
||||
|
||||
System.print(doc.querySelector("li:nth-child(3)") != null) // expect: true
|
||||
System.print(doc.querySelector("li:nth-child(3)").textContent) // expect: C
|
||||
|
||||
System.print(doc.querySelector("li:nth-child(5)") != null) // expect: true
|
||||
System.print(doc.querySelector("li:nth-child(5)").textContent) // expect: E
|
||||
|
||||
System.print(doc.querySelector("li:nth-child(6)") == null) // expect: true
|
||||
|
||||
Reference in New Issue
Block a user