{"version":3,"file":"kendo.dom.min.js","names":["factory","define","amd","kendo","Node","this","node","NullNode","prototype","remove","parentNode","removeChild","attr","text","nodeName","style","children","NULL_NODE","Element","TextNode","nodeValue","force","String","HtmlNode","html","appendTo","parent","document","createElement","index","length","render","appendChild","cached","cachedChildren","cachedLength","Math","abs","replaceChild","syncAttributes","removeAttributes","cachedAttr","name","value","cachedValue","setStyle","setAttribute","key","removeStyle","cachedStyle","undefined","removeAttribute","cssText","className","str","i","createTextNode","nodes","el","lastChild","HTML_CONTAINER","innerHTML","firstChild","insertHtml","child","nextSibling","push","slice","element","attrs","Tree","root","dom","window"],"sources":["kendo.dom.js"],"mappings":"CAAA,SAAWA,GACW,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,CAAC,kBAAmBD,GACxEA,IAFJ,EAGG,YASC,SAAUG,GACN,SAASC,IACLC,KAAKC,KAAO,KAgBhB,SAASC,KAbTH,EAAKI,UAAY,CACbC,OAAQ,WACAJ,KAAKC,KAAKI,YACVL,KAAKC,KAAKI,WAAWC,YAAYN,KAAKC,MAE1CD,KAAKO,KAAO,IAEhBA,KAAM,GACNC,KAAM,WACF,MAAO,KAOfN,EAASC,UAAY,CACjBM,SAAU,QACVF,KAAM,CAAEG,MAAO,IACfC,SAAU,GACVP,OAAQ,cAIZ,IAAIQ,EAAY,IAAIV,EAEpB,SAASW,EAAQJ,EAAUF,EAAMI,GAC7BX,KAAKS,SAAWA,EAEhBT,KAAKO,KAAOA,GAAQ,GAEpBP,KAAKW,SAAWA,GAAY,GAuJhC,SAASG,EAASC,EAAWC,GACzBhB,KAAKe,UAAYE,OAAOF,GACxBf,KAAKgB,MAAQA,EAoCjB,SAASE,EAASC,EAAMH,GACpBhB,KAAKmB,KAAOA,EACZnB,KAAKgB,MAAQA,EA5LjBH,EAAQV,UAAY,IAAIJ,EAExBc,EAAQV,UAAUiB,SAAW,SAASC,GAKlC,IAJA,IAAIpB,EAAiC,iBAAnBD,KAAa,SAAiBsB,SAASC,cAAc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AAMA,EACNkB,OAAQ,SAASf,GACb,IAEIa,EAEAC,EAJAI,EAAiB7B,KAAKW,SAM1B,IAAKa,EAAQ,EAAGC,EAASd,EAASc,OAAQD,EAAQC,EAAQD,IAAS,CAC/D,IAAII,EAASC,EAAeL,GACvBI,EAEOA,EAAO3B,MAAS2B,EAAO3B,KAAKI,aACpCuB,EAAOxB,SACPwB,EAAShB,GAHTgB,EAAShB,EAKbD,EAASa,GAAOE,OAAO1B,KAAKkE,KAAMtC,GAGtC,IAAKJ,EAAQC,EAAQD,EAAQK,EAAeJ,OAAQD,IAChDK,EAAeL,GAAOpB,SAG1BJ,KAAKW,SAAWA,IAIxBb,EAAMqE,IAAM,CACRhD,KAAMA,EACNX,KAAMA,EACNuD,QAASA,EACTE,KAAMA,EACNlE,KAAMA,GAlUd,CAoUGqE,OAAOtE","sourcesContent":["(function (factory) {\n typeof define === 'function' && define.amd ? define(['kendo.core'], factory) :\n factory();\n})((function () {\n var __meta__ = {\n id: \"dom\",\n name: \"Virtual DOM\",\n category: \"framework\",\n depends: [ \"core\" ],\n advanced: true\n };\n\n (function(kendo) {\n function Node() {\n this.node = null;\n }\n\n Node.prototype = {\n remove: function() {\n if (this.node.parentNode) {\n this.node.parentNode.removeChild(this.node);\n }\n this.attr = {};\n },\n attr: {},\n text: function() {\n return \"\";\n }\n };\n\n function NullNode() {\n }\n\n NullNode.prototype = {\n nodeName: \"#null\",\n attr: { style: {} },\n children: [],\n remove: function() {\n }\n };\n\n var NULL_NODE = new NullNode();\n\n function Element(nodeName, attr, children) {\n this.nodeName = nodeName;\n\n this.attr = attr || {};\n\n this.children = children || [];\n }\n\n Element.prototype = new Node();\n\n Element.prototype.appendTo = function(parent) {\n var node = typeof(this.nodeName) === \"string\" ? document.createElement(this.nodeName) : this.nodeName;\n\n var children = this.children;\n\n for (var index = 0; index < children.length; index++) {\n children[index].render(node, NULL_NODE);\n }\n\n parent.appendChild(node);\n\n return node;\n };\n\n Element.prototype.render = function(parent, cached) {\n var node;\n\n if (cached.nodeName !== this.nodeName) {\n cached.remove();\n\n node = this.appendTo(parent);\n } else {\n node = cached.node;\n\n var index;\n\n var children = this.children;\n\n var length = children.length;\n\n var cachedChildren = cached.children;\n\n var cachedLength = cachedChildren.length;\n\n if (Math.abs(cachedLength - length) > 2) {\n this.render({\n appendChild: function(node) {\n parent.replaceChild(node, cached.node);\n }\n }, NULL_NODE);\n\n return;\n }\n\n for (index = 0; index < length; index++) {\n children[index].render(node, cachedChildren[index] || NULL_NODE);\n }\n\n for (index = length; index < cachedLength; index++) {\n cachedChildren[index].remove();\n }\n }\n\n this.node = node;\n\n this.syncAttributes(cached.attr);\n\n this.removeAttributes(cached.attr);\n };\n\n Element.prototype.syncAttributes = function(cachedAttr) {\n var attr = this.attr;\n\n for (var name in attr) {\n var value = attr[name];\n\n var cachedValue = cachedAttr[name];\n\n if (name === \"style\") {\n this.setStyle(value, cachedValue);\n } else if (value !== cachedValue) {\n this.setAttribute(name, value, cachedValue);\n }\n }\n };\n\n Element.prototype.setStyle = function(style, cachedValue) {\n var node = this.node;\n var key;\n\n if (cachedValue) {\n for (key in style) {\n if (style[key] !== cachedValue[key]) {\n node.style[key] = style[key];\n }\n }\n } else {\n for (key in style) {\n node.style[key] = style[key];\n }\n }\n };\n\n Element.prototype.removeStyle = function(cachedStyle) {\n var style = this.attr.style || {};\n var node = this.node;\n\n for (var key in cachedStyle) {\n if (style[key] === undefined) {\n node.style[key] = \"\";\n }\n }\n };\n\n Element.prototype.removeAttributes = function(cachedAttr) {\n var attr = this.attr;\n\n for (var name in cachedAttr) {\n if (name === \"style\") {\n this.removeStyle(cachedAttr.style);\n } else if (attr[name] === undefined) {\n this.removeAttribute(name);\n }\n }\n };\n\n Element.prototype.removeAttribute = function(name) {\n var node = this.node;\n\n if (name === \"style\") {\n node.style.cssText = \"\";\n } else if (name === \"className\") {\n node.className = \"\";\n } else {\n node.removeAttribute(name);\n }\n };\n\n Element.prototype.setAttribute = function(name, value) {\n var node = this.node;\n\n if (node[name] !== undefined) {\n node[name] = value;\n } else {\n node.setAttribute(name, value);\n }\n };\n\n Element.prototype.text = function() {\n var str = \"\";\n for (var i = 0; i < this.children.length; ++i) {\n str += this.children[i].text();\n }\n return str;\n };\n\n function TextNode(nodeValue, force) {\n this.nodeValue = String(nodeValue);\n this.force = force;\n }\n\n TextNode.prototype = new Node();\n\n TextNode.prototype.nodeName = \"#text\";\n\n TextNode.prototype.render = function(parent, cached) {\n var node;\n\n if (cached.nodeName !== this.nodeName || this.force) {\n cached.remove();\n\n node = document.createTextNode(this.nodeValue);\n\n parent.appendChild(node);\n } else {\n node = cached.node;\n\n if (this.nodeValue !== cached.nodeValue) {\n if (node.parentNode) {\n // sometimes in IE parentNode is null (reason unknown),\n // and IE throws an error when you try to set a\n // parentless' nodeValue, because why not.\n node.nodeValue = this.nodeValue;\n }\n }\n }\n\n this.node = node;\n };\n\n TextNode.prototype.text = function() {\n return this.nodeValue;\n };\n\n function HtmlNode(html, force) {\n this.html = html;\n this.force = force;\n }\n\n HtmlNode.prototype = {\n nodeName: \"#html\",\n attr: {},\n remove: function() {\n for (var index = 0; index < this.nodes.length; index++) {\n var el = this.nodes[index];\n if (el.parentNode) {\n el.parentNode.removeChild(el);\n }\n }\n },\n render: function(parent, cached) {\n if (cached.nodeName !== this.nodeName || cached.html !== this.html || this.force) {\n cached.remove();\n\n var lastChild = parent.lastChild;\n\n insertHtml(parent, this.html);\n\n this.nodes = [];\n\n for (var child = lastChild ? lastChild.nextSibling : parent.firstChild; child; child = child.nextSibling) {\n this.nodes.push(child);\n }\n } else {\n this.nodes = cached.nodes.slice(0);\n }\n }\n };\n\n var HTML_CONTAINER = document.createElement(\"div\");\n\n function insertHtml(node, html) {\n HTML_CONTAINER.innerHTML = html;\n\n while (HTML_CONTAINER.firstChild) {\n node.appendChild(HTML_CONTAINER.firstChild);\n }\n }\n\n function html(value, force) {\n return new HtmlNode(value, force);\n }\n\n function element(nodeName, attrs, children) {\n return new Element(nodeName, attrs, children);\n }\n\n function text(value, force) {\n return new TextNode(value, force);\n }\n\n function Tree(root) {\n this.root = root;\n this.children = [];\n }\n\n Tree.prototype = {\n html: html,\n element: element,\n text: text,\n render: function(children) {\n var cachedChildren = this.children;\n\n var index;\n\n var length;\n\n for (index = 0, length = children.length; index < length; index++) {\n var cached = cachedChildren[index];\n if (!cached) {\n cached = NULL_NODE;\n } else if (!cached.node || !cached.node.parentNode) {\n cached.remove();\n cached = NULL_NODE;\n }\n children[index].render(this.root, cached);\n }\n\n for (index = length; index < cachedChildren.length; index++) {\n cachedChildren[index].remove();\n }\n\n this.children = children;\n }\n };\n\n kendo.dom = {\n html: html,\n text: text,\n element: element,\n Tree: Tree,\n Node: Node\n };\n })(window.kendo);\n\n}));\n"]}