/*! Knockout Fast Foreach v0.4.1 (2015-07-17T14:06:15.974Z) By: Brian M Hunt (C) 2015 License: MIT Adds `fastForEach` to `ko.bindingHandlers`. */ (function (root, factory) { if (typeof define === 'function' && define.amd) { define(['knockout'], factory); } else if (typeof exports === 'object') { module.exports = factory(require('knockout')); } else { root.KnockoutFastForeach = factory(root.ko); } }(this, function (ko) { "use strict"; // index.js // -------- // Fast For Each // // Employing sound techniques to make a faster Knockout foreach binding. // -------- // Utilities // from https://github.com/jonschlinkert/is-plain-object function isPlainObject(o) { return !!o && typeof o === 'object' && o.constructor === Object; } // From knockout/src/virtualElements.js var commentNodesHaveTextProperty = document && document.createComment("test").text === ""; var startCommentRegex = commentNodesHaveTextProperty ? /^$/ : /^\s*ko(?:\s+([\s\S]+))?\s*$/; var supportsDocumentFragment = document && typeof document.createDocumentFragment === "function"; function isVirtualNode(node) { return (node.nodeType === 8) && startCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue); } // Get a copy of the (possibly virtual) child nodes of the given element, // put them into a container, then empty the given node. function makeTemplateNode(sourceNode) { var container = document.createElement("div"); var parentNode; if (sourceNode.content) { // For e.g.