Incorrect loop logic in updateEventListeners meant that nodes right at the end of the anchorNode were skipped.

This commit is contained in:
Tony Garnock-Jones 2016-05-14 10:34:22 -04:00
parent bf532edd28
commit c7d91ac37f
1 changed files with 5 additions and 4 deletions

View File

@ -408,9 +408,10 @@ UIFragment.prototype.updateEventListeners = function (c, install) {
var handlerClosure = self.getEventClosure(c);
self.currentAnchorNodes.forEach(function (anchorNode) {
var uiNode = findInsertionPoint(anchorNode, self.currentOrderBy, self.fragmentId);
if (uiNode) uiNode = uiNode.previousSibling;
while (uiNode && hasSortKey(uiNode, self.currentOrderBy, self.fragmentId)) {
var insertionPoint = findInsertionPoint(anchorNode, self.currentOrderBy, self.fragmentId);
while (1) {
var uiNode = insertionPoint ? insertionPoint.previousSibling : anchorNode.lastChild;
if (!(uiNode && hasSortKey(uiNode, self.currentOrderBy, self.fragmentId))) break;
if ('querySelectorAll' in uiNode) {
var nodes = uiNode.querySelectorAll(c.selector);
for (var i = 0; i < nodes.length; i++) {
@ -423,7 +424,7 @@ UIFragment.prototype.updateEventListeners = function (c, install) {
}
}
}
uiNode = uiNode.previousSibling;
insertionPoint = uiNode;
}
});