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

Attributes vs. Properties #7

Open
cramertj opened this issue Jan 14, 2017 · 2 comments
Open

Attributes vs. Properties #7

cramertj opened this issue Jan 14, 2017 · 2 comments

Comments

@cramertj
Copy link
Owner

Currently, there's no distinction between attributes and properties-- attributes are used as attributes in HTML and as properties in the browser. This is necessary for things like "value" to work-- setting the "value" attribute in the browser doesn't change the content, and it's not possible to set properties in HTML AFAIK. However, this causes weirdness for things that have both an attribute and property with different names, such as "class" and "className". Elm special-cases a bunch of these names in order to apply them differently, but that's really messy. Attribute/property keys could be changed to an enum and matched on, but this has the unfortunate side effect of restricting keys to a predefined set, as well as requiring an import for each attribute used.

@cramertj
Copy link
Owner Author

After some thought, I'm probably just going to special-case certain strings, ala Elm. It's the easiest on users of the library, and it only imposes a tiny runtime cost (a single match statement).

@iqualfragile
Copy link

an enum seems to be the way to go design-wise. it would not restrict to a predefined set, if you add one variant to the enum typed Other(String).

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