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

onclick Event Handlers with nanohtml/raw #131

Open
unitof opened this issue Sep 14, 2018 · 1 comment
Open

onclick Event Handlers with nanohtml/raw #131

unitof opened this issue Sep 14, 2018 · 1 comment

Comments

@unitof
Copy link

unitof commented Sep 14, 2018

Normally, nanohtml intercepts the onclick property of its elements, and converts them to JS Event Listeners.

However, when I pass a string containing an HTML element with an onclick attribute through nanohtml/raw, the onclick attribute is passed through to the DOM as is, with no conversion to an Event Handler.

I have a script which parses my app's content for certain terms which should be clickable, and wraps them in a tag. That's why I'm using the raw function. Is it possible to pass raw HTML to nanohtml, but still have nanohtml handle onclicks as it usually does?

@unitof unitof changed the title onclick Event Handlers with nanohtml/raw onclick Event Handlers with nanohtml/raw Sep 14, 2018
@yoshuawuyts
Copy link
Member

@unitof could you perhaps create a code example? It's a bit hard to parse what you mean from just the text alone. Thanks!

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

No branches or pull requests

2 participants