Mithril version: I don't know version of Mithril, because this version doesn't contain m.version.
But I looked commits and this Mithril version has been added in 1 Jul 2015.
When I choose option in IE(10, 11), selected value doesn't show. Field of selector is empty.
In other browsers it works correctly.
View generation:
m "select.selector", {
disabled: !ctrl.overrideLocales(),
value: ctrl.locale(),
onchange: m.withAttr("value", ctrl.locale)
},
[mapArray(locales)]
mapArray method:
view : (ctrl) ->
mapArray = (arr) ->
m "option", [val.name ? val] for val in arr
If I paste attribute selected to option element in Developer Tools, it's displayed correctly in IE browser. But mithril doesn't allow me to insert this attr to element.
First of all, it should have the version string. Second of all, does it fail in both next and v0.2.3?
@isiahmeadows
But I looked commits and this Mithril version has been added in 1 Jul 2015.
m.version didn't exist until v0.2.1 which was in December 2015. It's probably v0.2.0 which was published in April 2015.
I do apologize for my initial blunt response here... I have a bad habit of
this.
On Thu, Mar 10, 2016, 14:53 Pat Cavit [email protected] wrote:
@isiahmeadows https://github.com/isiahmeadows
But I looked commits and this Mithril version has been added in 1 Jul 2015.
m.version didn't exist until v0.2.1 which was in December 2015. It's
probably v0.2.0 which was published in April 2015.—
Reply to this email directly or view it on GitHub
https://github.com/lhorie/mithril.js/issues/980#issuecomment-195019880.
@isiahmeadows no problems. I get this project from other guys and they don't know version of mithril.
But I posted mithril code here. Maybe it will help to determine the version.
@Grinv have you tried upgrading to 0.2.3?
@lhorie today I upgraded mithril version to 0.2.3. FYI: The project did't crushed. It's okey :+1:
But problem with selector still exists.
@Grinv ok thanks for the update.
Repros with 0.2.3: https://jsbin.com/dudetu/2/edit?html,js,output
Firefox/Chrome both show "Two" as selected, but IE11 & Edge show "One".
Here is the solution:
m.render(
document.body,
m("select", { value : "Two" },
m("option", { value : "One" }, "One"),
m("option", { value : "Two" }, "Two")
)
)
I think i have seen this happen with IE regardless if you use mithril or not.
I think IE needs value property on options.
@tivac I don't have an IE readily available ATM (at least on Ubuntu :smile:), so would you mind verifying that?
@gyandeeps Works in IE11/Edge, nice catch :+1:
https://jsbin.com/girulokepu/1/edit?js,output
@Grinv Looks like for IE you need to add specific values to each <option>, otherwise setting a value on the <select> won't do what you expect.
@tivac @gyandeeps I just tried this method and it works correctly!
@isiahmeadows @tivac @lhorie @gyandeeps thanks guys for your help and support :+1:
Hey guys, this is one of those DOM gotchas that often end up being assumed to be a Mithril bug because Mithril abstracts away the DOM API. How about adding a section to the wiki to document good old DOM gotchas? The problems are usually well documented elsewhere, so this could end up really easy and useful for people to see (maybe in the issue submission template?) if their perceived Mithril DOM issue was actually a real DOM issue…
@barneycarroll If you're okay with it, feel free to add that section
yourself. :-)
On Mon, Mar 14, 2016, 14:58 Barney Carroll [email protected] wrote:
Hey guys, this is one of those DOM gotchas that often end up being assumed
to be a Mithril bug because Mithril abstracts away the DOM API. How about
adding a section to the wiki to document good old DOM gotchas? The problems
are usually well documented elsewhere, so this could end up really easy and
useful for people to see (maybe in the issue submission template?) if their
perceived Mithril DOM issue was actually a real DOM issue…—
Reply to this email directly or view it on GitHub
https://github.com/lhorie/mithril.js/issues/980#issuecomment-196472068.
This okay to close?
@isiahmeadows yes. I solved the problem.
Most helpful comment
@gyandeeps Works in IE11/Edge, nice catch :+1:
https://jsbin.com/girulokepu/1/edit?js,output
@Grinv Looks like for IE you need to add specific
values to each<option>, otherwise setting avalueon the<select>won't do what you expect.