dfilatov / vidom

Library to build UI based on virtual DOM
MIT License
415 stars 16 forks source link

properties names inconsistency #8

Closed gaydenko closed 9 years ago

gaydenko commented 9 years ago

Hi! At the README.md end we get:

    return vidom.createNode('div')
        .attrs({ className : 'input' })
        .children(vidom.createNode('input').attrs({ type : 'text', className : 'input__control' }));

As far as to define CSS class className is using, it's natural to conclude DOM node properties are supposed. On the other hand, the function is named as attrs. I guess, here we get naming inconsistency, as far as attributes is associated with HTML attributes rather than with DOM node properties.

Probably, the best way is to use both (with some denoted contract who win, say, the last in call chain), that is attributes and properties functions named as attrs and props respectively (as, say, is done in Trackira), and for now just to rename attrs to props.

dfilatov commented 9 years ago

I don't like to expose two functions attrs and props and make user think which one should be called every time. I think the difference between HTML attributes and DOM properties should be processed inside engine. But renaming to props sounds reasonable.

gaydenko commented 9 years ago

the difference between HTML attributes and DOM properties should be processed inside engine

Does it mean user can use both properties' and attributes' names?

dfilatov commented 9 years ago

Yes, it does.

gaydenko commented 9 years ago

Thanks for the clarification!