tmpvar / weld

Template antimatter for Node.js (Browsers too!)
674 stars 39 forks source link

Add support for select menus. #42

Closed countable closed 9 years ago

countable commented 11 years ago

element.setAttribute('value', value) doesn't work for select elements, but setting element.value directly does work, as per:

http://stackoverflow.com/questions/78932/how-do-i-programatically-set-the-value-of-a-select-box-element-using-javascript

tmpvar commented 11 years ago

what happens when we want to populate the select box?

countable commented 11 years ago

Sorry, I'm not sure what you mean by populate the select box. Do you mean the case when more options are added to the select menu on the client after the weld happens? If so, this case isn't covered and weld would have to be refreshed after doing that. This change is just a bugfix. The code will work exactly as before except select elements will be set to the passed value like all other elements when weld is called. Do you mind explaining what you mean a bit more, or add a failing test case that explains it? :)

tmpvar commented 11 years ago

What I'm trying to say is that select should probably be treated like a ul/li combo where the option elements are added from an array in the data. That said, this change is good and definitely needed, but I'd like to think for a second about the other case and how it interoperates with this change.

countable commented 11 years ago

Got it, that sounds like a bigger question I won't pretend to have an answer to. Well, thanks for weld! It's a nice alternative to using template systems!

tmpvar commented 9 years ago

hey, sorry this took so long. I've added you as a contributor in the event you want to sidestep my insanely slow response time!