bikeshaving / crank

The Just JavaScript Framework
https://crank.js.org
MIT License
2.7k stars 75 forks source link

Boolean attributes/properties like spellcheck. #175

Closed brainkim closed 3 years ago

brainkim commented 4 years ago

A funny bug. The spellcheck property is a boolean, but the spellcheck attribute is either the "true" or "false" string. When attempting to set the spellcheck property to the "false" string, it gets set to true because this string itself is truthy. I think we might need a better global list of which props should be dealt with as properties versus which props should be dealt with as attributes. If you know a library which has a good global list of these props/attributes lemme know.

In the meantime, if you encounter a bug like this you can use spellcheck={false} to set the boolean property directly.

brainkim commented 3 years ago

This file from React seems to have a wealth of information about various attributes. https://github.com/facebook/react/blob/master/packages/react-dom/src/shared/DOMProperty.js

brainkim commented 3 years ago

Fixed in 0.4