choojs / choojs/nanohtml

onclick Event Handlers with nanohtml/raw

Open
#131 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
688
Forks
48
PR merge metrics
No merged PRs in 30d

Description

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 `onclick`s as it usually does?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.