|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "html" for Document
|
|
|
|
var doc = Document.parse("<div id='test' class='box container'><p>Text</p></div>")
|
|
|
|
var div = doc.querySelector("div")
|
|
|
|
System.print(div.matches("div")) // expect: true
|
|
System.print(div.matches("#test")) // expect: true
|
|
System.print(div.matches(".box")) // expect: true
|
|
System.print(div.matches(".container")) // expect: true
|
|
System.print(div.matches("div.box")) // expect: true
|
|
System.print(div.matches("div#test")) // expect: true
|
|
|
|
System.print(div.matches("span")) // expect: false
|
|
System.print(div.matches("#other")) // expect: false
|
|
System.print(div.matches(".other")) // expect: false
|
|
|
|
var p = doc.querySelector("p")
|
|
System.print(p.matches("p")) // expect: true
|
|
System.print(p.matches("div")) // expect: false
|
|
|