fazibear / opal-virtual-dom

virtual-dom wrapper for opal
MIT License
24 stars 6 forks source link

Treat "aria" dict like "data" dict #10

Closed ryanprior closed 6 years ago

ryanprior commented 6 years ago

Items in the "data" dict are prefixed with data- and added to the element's properties. The same needs to be done for the "aria" dict. For example,

div data: {toggle: 'dropdown'}, aria: {haspopup: 'true'}

should be rendered as

<div data-toggle="dropdown" aria-haspopup="true"></div>
ryanprior commented 6 years ago

Similar discussion of this in React: https://github.com/facebook/react/issues/1259

From that discussion, it may be preferable to support ARIA props like div aria_haspopup: 'true' instead of making it a dict. Since we kinda get to create our own API, which do you think is nicer / more idiomatic Ruby?

fazibear commented 6 years ago

It's far beyond simple virtual-dom lib. It can be archived by creating simple helpers that will extend virtual-dom functionality. If someone need it just require another gem.

Feel free to write such an extension.

I'm a big fan of small specific libraries.

fazibear commented 6 years ago

But look at this: https://inesita.fazibear.me/#dom-dsl

This is an virtual-dom javascript library feature. Should work ootb.