Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with keyed objects #246

Closed
fspeech opened this issue Sep 15, 2014 · 2 comments
Closed

Error with keyed objects #246

fspeech opened this issue Sep 15, 2014 · 2 comments
Labels
Type: Bug For bugs and any other unexpected breakage

Comments

@fspeech
Copy link

fspeech commented Sep 15, 2014

The following code produced a TypeError: Argument 1 of Node.insertBefore is not an object. from line 129 of mithril (running in Firefox). However if you comment out the line inserting m("br") the error goes away (but of course renders with the input boxes on the same line). So it appears that the handling of keyed objects mixed with unkeyed objects is incorrect.

<script src="mithril-0.1.21/mithril.js"></script>

<body>
  <div id="testdiv">
  <script>
    var test = {}, p1 = m.prop(''), p2 = m.prop('');
    var f = [m("input", {onchange:m.withAttr("value", p2), value:p2(), key:2})];
    test.controller = function() {};
    test.view = function(c) {
    return m("div", f)
    };
    m.module(testdiv, test);
    f.unshift(m("br"));
    f.unshift(m("input", {onchange:m.withAttr("value", p1), value:p1(), key:1}))
    window.setTimeout(function() {m.redraw(true);}, 2000)
  </script>
</body>
@lhorie
Copy link
Member

lhorie commented Sep 15, 2014

Thanks for reporting! I'll look into it.

@lhorie lhorie added the Type: Bug For bugs and any other unexpected breakage label Sep 15, 2014
@lhorie
Copy link
Member

lhorie commented Sep 15, 2014

This is fixed in origin/next and scheduled to be released in v0.1.22

@lhorie lhorie closed this as completed Sep 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug For bugs and any other unexpected breakage
Projects
None yet
Development

No branches or pull requests

2 participants