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
Remove NodeLists from Stache #1048
This not-working pull request begins the ability to remove nodeLists from can.stache. When fully implemented, this will dramatically improve live-binding performance in IE8.
It is impossible in IE8 and lower to set expando properties on textNodes. For example, the following does not work:
var tn = document.createTextNode("foo"); tn.expandoProperty = 5;
It is impossible to give an ID to a textNode so we must use an array instead. This changes a critical path in live-binding from O(1) to O(n) where n is the number of textNodes being live bound.
For templates like:
It is important for the
where text nodes are represented by
This array of arrays structure is used to remove elements if
This branch includes a SectionNode construct which can represent
When a live-bound element is found, it should check its parent SectionNode for the same element and replace the parent SectionNode's array's element with a pointer to the child SectionNode in a similar way that happens with NodeLists.
This will be MUCH faster for IE8 as it will only have to find the textNode that is being replaced within its parent Section's nodes.