Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js.dom: add querySelector[All] and NodeList #20240

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion vlib/js/dom/dom.js.v
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ pub interface JS.Node {
lookupPrefix(namespace JS.String) JS.String
normalize()
removeChild(child JS.Node) JS.Node
replaceChild(node JS.Node, child JS.Node) JS.Npde
replaceChild(node JS.Node, child JS.Node) JS.Node
mut:
nodeValue JS.String
textContent JS.String
Expand Down Expand Up @@ -378,6 +378,8 @@ pub interface JS.HTMLElement {
offsetTop JS.Number
offsetWidth JS.Number
click()
querySelector(selectors JS.String) ?JS.HTMLElement
querySelectorAll(selectors JS.String) JS.NodeList
mut:
accessKey JS.String
autocapitalize JS.String
Expand All @@ -392,6 +394,14 @@ mut:
translate JS.Boolean
}

pub type NodeListForEachCb = fn (JS.HTMLElement, JS.Number, JS.NodeList)

pub interface JS.NodeList {
length JS.Number
forEach(cb NodeListForEachCb, thisArg JS.Any)
item(idx JS.Number) ?JS.Any
}

pub fn JS.HTMLElement.prototype.constructor() JS.HTMLElement

pub interface JS.HTMLEmbedElement {
Expand Down
Loading