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

HtmlElement.ofNode doesn't do any type html element specific checking #75

Open
spocke opened this issue Dec 28, 2021 · 1 comment
Open

Comments

@spocke
Copy link
Collaborator

spocke commented Dec 28, 2021

The HtmlElement.ofNode function is just inherited from Element so it allows you to pass in Elements and get them converted to HtmlElements without any check so it's not really type safe.

So this will set the non existing contentEditable property on plain elements.
node->HtmlElement.ofNode->Belt.Option.forEach(HtmlElement.setContentEditable(True))

@spocke spocke mentioned this issue Dec 28, 2021
@TheSpyder
Copy link
Owner

oh hmm I forgot we had both ofElement and ofNode. I think we might need to remove ofNode from the inheritance chain; it's only correct for elements not most places Element is included.

Either that or override it in HtmlElement to just use the ofElement implementation which should work for both elements and nodes.

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