Creates an instance of `Collection`.

@constructor
@param {Array} nodes DOM elements to wrap.
@api protected
321700
function Collection(nodes) {
  this.length = 0;
  if (nodes) {
    nodes = unique(nodes);
    this.length = nodes.length;
    // add each node to an index-based property on collection, in order to
    // appear "array"-like
    for (var i = 0, len = nodes.length; i < len; i++) {
      this[i] = nodes[i];
    }
  }
}
407919
function collection$$1(eles, opts) {
    if (string(eles)) {
      return this.$(eles);
    } else if (elementOrCollection(eles)) {
      return eles.collection();
    } else if (array(eles)) {
      return new Collection(this, eles, opts);
    }

    return new Collection(this);
  }
260777
function forEach(callback) {
                if (typeof callback !== 'function') {
                    throw new TypeError('forEach() callback must be a function');
                }

                // run this node through function
                callback(this);

                // do the same for all children
                if (this.children) {
                    for (var i = 0, _length3 = this.children.length; i < _length3; i++) {
                        this.children[i].forEach(callback);
                    }
                }

                return this;
            }
572014
function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        h.concat(results, node.getElementsByTagName('*'));
      return results;
    }
256963
function ListNode (children) {
    for(var i = 0; i < children.length; i++)
        this[i] = children[i];
    this.length = children.length;
}
720377
function createChildren(el, attr) {
	var children = [];
	for (var i = 0; i < el.childNodes.length; i++) {
		children.push(createNode(el.childNodes[i], attr));
	};

	return children;
}
1202314
function traverseNodes(nodes, visitor) {
    const ne = new NodeEventGenerator(visitor)
    traverse(nodes, {
        enter(child) {
            ne.enterNode(child)
        },

        leave(child) {
            ne.leaveNode(child)
        },
    })
}
572974
function nodesToArray(nodes) {
    if (!nodes || nodes.length === 0) {
        return false;
    } else {
        return nodes.length ? [].slice.call(nodes) : [nodes];
    }
}
538244
function(tag, nodes) {
    var xmlNodes = nodes.map(function(x) {return x.xml(xml, opt_brief);});
    var tagNode = xml.createElementNS('', tag);
    for (var i = 0, child; child = xmlNodes[i]; i++) {
      tagNode.appendChild(child);
    }
    return tagNode;
  }
872934
function() {
    var slice = Array.prototype.slice;
    var args = slice.call(arguments);
    var nodeLists = args.map(function(list) {
      return slice.call(list);
    });
    return Array.prototype.concat.apply([], nodeLists);
  }
782534
def add_node_collection(self, node, collection):
        
        assert node in self.node2pending
        if self.collection_is_completed:
            # A new node has been added later, perhaps an original one died.
            # .schedule() should have
            # been called by now
            assert self.collection
            if collection != self.collection:
                other_node = next(iter(self.node2collection.keys()))
                msg = report_collection_diff(
                    self.collection, collection, other_node.gateway.id, node.gateway.id
                )
                self.log(msg)
                return
        self.node2collection[node] = list(collection)
821957
function buildElementsTree(contexts) {

	contexts = contexts || [document];

	var queriesArray = Object.keys(queries).map(function(key) {
		return queries[key];
	});

	var selector = queriesArray.map(function(query) {
		return query._selector;
	}).join(',');

	var elements = [];
	contexts.forEach(function(context) {
		for (var node = context.parentNode; node; node = node.parentNode) {
			// Skip nested contexts
			if (contexts.indexOf(node) !== -1) {
				return;
			}
		}
		if (context !== document && elementMatchesSelector(context, selector)) {
			elements.push(context);
		}
		elements.push.apply(elements, arrayFrom(context.querySelectorAll(selector)));
	});

	var tree = [];
	var treeCache = createCacheMap();

	elements.forEach(function(element) {

		if (element === documentElement) {
			return;
		}

		var treeNode = {
			_element: element,
			_children: [],
			_queries: [],
			_changes: [],
			_done: false,
		};

		var children = tree;
		for (var node = element.parentNode; node; node = node.parentNode) {
			if (treeCache.get(node)) {
				children = treeCache.get(node)._children;
				break;
			}
		}

		treeCache.set(element, treeNode);

		children.push(treeNode);

		queriesArray.forEach(function(query) {
			if (elementMatchesSelector(element, query._selector)) {
				treeNode._queries.push(query);
			}
		});

	});

	return tree;

}
764074
function addChildren(node) {
    var children = node._private.children;

    for (var i = 0; i < children.length; i++) {
      add(children[i]);
    }
  }
356334
function _mutation(nodes) { // eslint-disable-line no-unused-vars
	if (!nodes.length) {
		throw new Error('DOM Exception 8');
	} else if (nodes.length === 1) {
		return typeof nodes[0] === 'string' ? document.createTextNode(nodes[0]) : nodes[0];
	} else {
		var
		fragment = document.createDocumentFragment(),
		length = nodes.length,
		index = -1,
		node;

		while (++index < length) {
			node = nodes[index];

			fragment.appendChild(typeof node === 'string' ? document.createTextNode(node) : node);
		}

		return fragment;
	}
}
830298
function(node) {
         var newNode = function(data, next) {
             var that = {};
             that.getData = function() {
                 return data;
             };
             that.getNext = function() {
                 return next;
             };
             return that;
         };
         var top = node || null;
         var that = {};

         that.__push_internal__ = function(data) {
             return newStack(newNode(data, top));
         };

         that.__peek__ = function() {
             return top && top.getData();
         };

         that.__pop_internal__ = function() {
             return top && newStack(top.getNext());
         };

         that.__forEach__ = function(f) {
             var i = top;
             var s = 0;
             while (i !== null) {
                 f(i.getData(), s);
                 s = s +1;
                 i = i.getNext();
             }
         };
         that.__map__ = function(f) {
             var i = top;
             var result = [];
             while (i !== null) {
                 result.push(f(i.getData()));
                 i = i.getNext();
             }
             return result;
         };

         that.__length__ = function() {
             var count = 0;
             that.__forEach__(function() { count = count + 1;});
             return count;
         };

         return that;
     }
818155
function (nodesToAppend) {
            let nodes = Array.prototype.slice.call(nodesToAppend);

            for (let i = 0, len = nodes.length; i < len; ++i) {
                el.appendChild(nodes[i]);
            }
        }
855971
function Collection (items) {
		this.items = new ok.Items();
		this.start();
		if (items) {
			this.add(items);
		}
		this.init();
	}