How exactly the live binding is done and why it can't be done for each individual list item?
As I see, you can "live bind" the item attributes
- <%= car.attr('name') %>
and only that will get re-rendered when the item is changed, not the whole list. Why can't it be so with the list items (elements)? I really disagree that the performance is bad when you have to add a single (!) newly created element. I don't believe that it's faster to re-render all, let's say 1000 element, list.
Ok, I'm not going to test this right now because it's midnight, but I think that I may be right.
Just think about it - you have a 1000 items in the list and you crate a new one... Let's say that appending to the list takes twice as much (and it depends on the browser, this time for Firefox) than using innerHTML. What's faster - to append single element to the list or rebuild 1000 items by using innerHTML? Math is simple here.
I don't understand the functionality (live binding) here, because I haven't red all the code, but, please, try to figure this out, because I believe that it is better.
Isn't the canJS setting a references to the elements? An example how I have done something like that with jQuery:
- var car = new Car('BMW X5'); // creating a new Car model
- car.$el = $('<li></li>').text(car.name); // creating a HTML element and putting text inside
- car.$el.appendTo('#cars'); // appending the HTML element to the list
- car.$el.remove(); // removing the HTML element from the list
What's the problem with something like this? Why it can't be automatically done in canJS? How that <%= car.attr('name') %> is being done and isn't it being done the sime like this with keeping references to the HTML element?
There are many frameworks out there, I find the canJS simplest, because I can use it as a jQuery extension (or vice-verse) and I don't have to compile anything. I just disagree that this thing can't be done.