/*! domx-repeat - v0.3.2 - 2016-09-22 * http://esha.github.io/domx-repeat/ * Copyright (c) 2016 ESHA Research; Licensed MIT, GPL */ (function(D) { "use strict"; // shortcuts var X = D.x, _ = X._; var R = _.repeat = { id: 'x-repeat-id', each: 'x-repeat-each', context: 'html,[x-repeat-init]', count: 0, initAll: function() { D.queryAll(R.context).each(function(context) { var init = context.getAttribute('x-repeat-init') || 'DOMContentLoaded', listener = function() { D.removeEventListener(init, listener); context.queryAll('[x-repeat]') .not('['+R.id+']') .each(R.init); }; if (init !== 'true') { context.setAttribute('x-repeat-init', 'true'); D.addEventListener(init, listener); } }); }, init: function(el, keep) { var selector = el.getAttribute('x-repeat'), id = R.count++, content = selector && D.query(selector).cloneNode(true) || el, anchor = D.createElement('x-repeat'); content.setAttribute(R.id, id); anchor.setAttribute(R.id, id); for (var i=0,m=el.attributes.length; i