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

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

merged 1 commit into from Dec 21, 2023

Conversation

moixllik
Copy link
Contributor

Example:

// v -b js_browser .
import js.dom

fn main() {
	document := dom.document
	mut h1 := document.body.querySelector('main h1'.str)?
	list := document.body.querySelectorAll('ul li'.str)

	h1.innerText = 'Hello, world!'.str
	list.forEach(fn (elem JS.HTMLElement, num JS.Number, list JS.NodeList) {
		JS.console.log(elem)
	}, false)
}

@spytheman spytheman merged commit ed754cf into vlang:master Dec 21, 2023
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants