Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Cannot assign empty string value to select option #1814
The following hyperscript will not set the select option value to ''
Instead, the value of that option will be 'Choose...'
jsbin demo comparing behaviour of plain HTML and Mithril: https://jsbin.com/zoqajeyoso/edit?html,js,output
referenced this issue
Apr 27, 2017
I think it comes down to this line: https://github.com/lhorie/mithril.js/blob/next/render/render.js#L484
It's tricky to solve though because of that Chrome hack. I think while the option element is built, it has no children (the text content) and therefore its value is == ''. It's only after the text child is added that the value will be different from ''. I tried changing the comparison to === but it doesn't seem to work; I suppose the value is an empty string by default.
I wonder if that Chrome hack is still necessary. Removing that line makes the test pass.
EDIT: Not sure, but maybe this would work: