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

A "better than the standards" suggestion for API #86

Open
rjcorwin opened this issue Sep 13, 2017 · 1 comment
Open

A "better than the standards" suggestion for API #86

rjcorwin opened this issue Sep 13, 2017 · 1 comment

Comments

@rjcorwin
Copy link

The API for form elements in standard HTML and in Polymer iron-form elements is more complicated than it needs to be. I propose that every element with a name attribute would have a corresponding value attribute, and we call it a day.

For example, the API for paper-radio-group element...

<paper-radio-group selected="small">
  <paper-radio-button name="small">Small</paper-radio-button>
  <paper-radio-button name="medium">Medium</paper-radio-button>
  <paper-radio-button name="large">Large</paper-radio-button>
</paper-radio-group>

... could become simpler by modeling after a standard HTML select list like...

<select name="shirt-size">
  <option value="small" selected>Small</option>
  <option value="medium">Medium</option>
  <option value="large">Large</option>
</select>

... but could be better than the select list API by doing away with selected boolean and instead stay consistent with the "every element with a name attribute has a corresponding value attribute" proposal...

<paper-radio-group name="shirt-size" value="small">
  <paper-radio-button value="small">Small</paper-radio-button>
  <paper-radio-button value="medium">Medium</paper-radio-button>
  <paper-radio-button value="large">Large</paper-radio-button>
</paper-radio-group>
@rjcorwin
Copy link
Author

If it interests anyone here, we're trying to document the Iron Form Elements API here and also discussing its design PolymerElements/iron-form#217

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

1 participant