var $, Context, Transparency, _, helpers, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; _ = require('../lib/lodash.js'); helpers = require('./helpers'); Context = require('./context'); Transparency = {}; Transparency.render = function(context, models, directives, options) { var base, log; if (models == null) { models = []; } if (directives == null) { directives = {}; } if (options == null) { options = {}; } log = options.debug && console ? helpers.consoleLogger : helpers.nullLogger; log("Transparency.render:", context, models, directives, options); if (!context) { return; } if (!_.isArray(models)) { models = [models]; } context = (base = helpers.data(context)).context || (base.context = new Context(context, Transparency)); return context.render(models, directives, options).el; }; Transparency.matcher = function(element, key) { return element.el.id === key || indexOf.call(element.classNames, key) >= 0 || element.el.name === key || element.el.getAttribute('data-bind') === key; }; Transparency.clone = function(node) { return $(node).clone()[0]; }; Transparency.jQueryPlugin = helpers.chainable(function(models, directives, options) { var context, i, len, results; results = []; for (i = 0, len = this.length; i < len; i++) { context = this[i]; results.push(Transparency.render(context, models, directives, options)); } return results; }); if ((typeof jQuery !== "undefined" && jQuery !== null) || (typeof Zepto !== "undefined" && Zepto !== null)) { $ = jQuery || Zepto; if ($ != null) { $.fn.render = Transparency.jQueryPlugin; } } if (typeof module !== "undefined" && module !== null ? module.exports : void 0) { module.exports = Transparency; } if (typeof window !== "undefined" && window !== null) { window.Transparency = Transparency; } if (typeof define !== "undefined" && define !== null ? define.amd : void 0) { define(function() { return Transparency; }); }