node) gives the wrong object #158

ile opened this Issue Oct 24, 2012 · 6 comments


None yet
4 participants

ile commented Oct 24, 2012!topic/derbyjs/-RaUK0cH0Ak

I'm having a problem getting the model from a DOM object. I have a list (ul) of things, made with #each. gives a wrong object.


        {#each _items}
            <li x-bind="click:text">{.price}</li>


model.set '_items', [
  { name: 'Can', price: 5.99, url: '/p/0' }
  { name: 'Fin', price: 10.99, url: '/p/1' }
  { name: 'Bot', price: 24.95, url: '/p/2' }

Bound function:

  exports.test = (e, el) ->

So, the HTML page looks like this:

  • 5.99
  • 10.99
  • 24.95

When I click the first one on the list, I get this output:

Object {name: "Fin", price: 10.99, url: "/p/1"} 

This is the next (2nd) one in the model, not the first one I clicked. If I click the 2nd from the list, it would skip to the fourth one if there was anything there.

Also the same happens if I use the el variable instead of in the test function.

So.. I'm at loss here. Is this a bug, anyone seen this? I'm using derby 0.3.13.

ile commented Oct 29, 2012

Here's a testcase for it.

The issue can be seen in the url /pim which renders the pim.html file.

Url / (index.html) has the same content as /pim, but node) works there.


I had the same problem. I just submitted a patch. The problem is the whitespace between the li tag and the {#each}. If you remove it the problem should go away. []

ile commented Nov 14, 2012

My issue was different. The testcase above shows the problem.

ile commented Jan 31, 2013

BTW, I needed at least two things: 1) getting rid of the white space and 2) adding the end tag to the component.

Hi @ile, try the changes I proposed at #204 for function into derby.Model.js file. That got my app to work again even with nested each loops and lot of conditional blocks, and no matter if there are spaces or comments.


nateps commented Apr 10, 2014

Master of Derby is now the rewritten 0.6 and I am removing previous issues pretty aggressively so that I can be more responsive to new issues.

Please re-open if this issue is still relevant in Derby 0.6.

nateps closed this Apr 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment