Skip to content

Allow virtualization to set up link click listeners #137

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lydell
Copy link

@lydell lydell commented Jun 1, 2025

Closes #105 together with elm/virtual-dom#187

The code already sets __VirtualDom_divertHrefToApp before each render, so that <a> elements created during the render can get a click listener that directs the link click to the update function, letting it decided what should happen. https://github.com/elm/browser/blob/1.0.2/src/Elm/Kernel/Browser.js#L81-L87

This PR also sets __VirtualDom_divertHrefToApp before virtualization, so that <a> HTML elements that are picked up by Elm during initialization also can get their click listener – which is implemented in elm/virtual-dom#187.

Note to those following along: This PR is included in https://github.com/lydell/browser/tree/safe, which is part of https://github.com/lydell/elm-safe-virtual-dom.

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.

Broken links in Browser.application with prerendered content
1 participant