{"version":3,"sources":["kendo.dom.js"],"names":["f","define","kendo","Node","this","node","NullNode","Element","nodeName","attr","children","TextNode","nodeValue","HtmlNode","html","insertHtml","HTML_CONTAINER","innerHTML","firstChild","appendChild","value","element","attrs","text","Tree","root","NULL_NODE","prototype","remove","parentNode","removeChild","style","appendTo","parent","index","document","createElement","length","render","cached","cachedChildren","cachedLength","Math","abs","replaceChild","syncAttributes","removeAttributes","cachedAttr","name","cachedValue","setStyle","setAttribute","key","removeStyle","cachedStyle","undefined","removeAttribute","cssText","className","i","str","createTextNode","nodes","lastChild","child","nextSibling","push","slice","dom","window","amd","a1","a2","a3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,aAAc,cAAeD,IACtC,WAiPE,MAzOC,UAAUE,GACP,QAASC,KACLC,KAAKC,KAAO,KAYhB,QAASC,MAUT,QAASC,GAAQC,EAAUC,EAAMC,GAC7BN,KAAKI,SAAWA,EAChBJ,KAAKK,KAAOA,MACZL,KAAKM,SAAWA,MAkHpB,QAASC,GAASC,GACdR,KAAKQ,UAAYA,EAqBrB,QAASC,GAASC,GACdV,KAAKU,KAAOA,EAyBhB,QAASC,GAAWV,EAAMS,GAEtB,IADAE,EAAeC,UAAYH,EACpBE,EAAeE,YAClBb,EAAKc,YAAYH,EAAeE,YAGxC,QAASJ,GAAKM,GACV,MAAO,IAAIP,GAASO,GAExB,QAASC,GAAQb,EAAUc,EAAOZ,GAC9B,MAAO,IAAIH,GAAQC,EAAUc,EAAOZ,GAExC,QAASa,GAAKH,GACV,MAAO,IAAIT,GAASS,GAExB,QAASI,GAAKC,GACVrB,KAAKqB,KAAOA,EACZrB,KAAKM,YA9MZ,GAuBOgB,GAqKAV,CAxLJb,GAAKwB,WACDC,OAAQ,WACJxB,KAAKC,KAAKwB,WAAWC,YAAY1B,KAAKC,MACtCD,KAAKK,SAETA,QACAc,KAAM,WACF,MAAO,KAKfjB,EAASqB,WACLnB,SAAU,QACVC,MA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B,MAAKM,SAAWA,IAGxBR,EAAMkE,KACFtD,KAAMA,EACNS,KAAMA,EACNF,QAASA,EACTG,KAAMA,EACNrB,KAAMA,IAEZkE,OAAOnE,OACFmE,OAAOnE,OACE,kBAAVD,SAAwBA,OAAOqE,IAAMrE,OAAS,SAAUsE,EAAIC,EAAIC,IACrEA,GAAMD","file":"kendo.dom.min.js","sourcesContent":["/*!\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n*/\n(function (f, define) {\n define('kendo.dom', ['kendo.core'], f);\n}(function () {\n var __meta__ = {\n id: 'dom',\n name: 'Virtual DOM',\n category: 'framework',\n depends: ['core'],\n advanced: true\n };\n (function (kendo) {\n function Node() {\n this.node = null;\n }\n Node.prototype = {\n remove: function () {\n this.node.parentNode.removeChild(this.node);\n this.attr = {};\n },\n attr: {},\n text: function () {\n return '';\n }\n };\n function NullNode() {\n }\n NullNode.prototype = {\n nodeName: '#null',\n attr: { style: {} },\n children: [],\n remove: function () {\n }\n };\n var NULL_NODE = new NullNode();\n function Element(nodeName, attr, children) {\n this.nodeName = nodeName;\n this.attr = attr || {};\n this.children = children || [];\n }\n Element.prototype = new Node();\n Element.prototype.appendTo = function (parent) {\n var node = document.createElement(this.nodeName);\n var children = this.children;\n for (var index = 0; index < children.length; index++) {\n children[index].render(node, NULL_NODE);\n }\n parent.appendChild(node);\n return node;\n };\n Element.prototype.render = function (parent, cached) {\n var node;\n if (cached.nodeName !== this.nodeName) {\n cached.remove();\n node = this.appendTo(parent);\n } else {\n node = cached.node;\n var index;\n var children = this.children;\n var length = children.length;\n var cachedChildren = cached.children;\n var cachedLength = cachedChildren.length;\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 return;\n }\n for (index = 0; index < length; index++) {\n children[index].render(node, cachedChildren[index] || NULL_NODE);\n }\n for (index = length; index < cachedLength; index++) {\n cachedChildren[index].remove();\n }\n }\n this.node = node;\n this.syncAttributes(cached.attr);\n this.removeAttributes(cached.attr);\n };\n Element.prototype.syncAttributes = function (cachedAttr) {\n var attr = this.attr;\n for (var name in attr) {\n var value = attr[name];\n var cachedValue = cachedAttr[name];\n if (name === 'style') {\n this.setStyle(value, cachedValue);\n } else if (value !== cachedValue) {\n this.setAttribute(name, value, cachedValue);\n }\n }\n };\n Element.prototype.setStyle = function (style, cachedValue) {\n var node = this.node;\n var key;\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 Element.prototype.removeStyle = function (cachedStyle) {\n var style = this.attr.style || {};\n var node = this.node;\n for (var key in cachedStyle) {\n if (style[key] === undefined) {\n node.style[key] = '';\n }\n }\n };\n Element.prototype.removeAttributes = function (cachedAttr) {\n var attr = this.attr;\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 Element.prototype.removeAttribute = function (name) {\n var node = this.node;\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 Element.prototype.setAttribute = function (name, value) {\n var node = this.node;\n if (node[name] !== undefined) {\n node[name] = value;\n } else {\n node.setAttribute(name, value);\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 function TextNode(nodeValue) {\n this.nodeValue = nodeValue;\n }\n TextNode.prototype = new Node();\n TextNode.prototype.nodeName = '#text';\n TextNode.prototype.render = function (parent, cached) {\n var node;\n if (cached.nodeName !== this.nodeName) {\n cached.remove();\n node = document.createTextNode(this.nodeValue);\n parent.appendChild(node);\n } else {\n node = cached.node;\n if (this.nodeValue !== cached.nodeValue) {\n node.nodeValue = this.nodeValue;\n }\n }\n this.node = node;\n };\n TextNode.prototype.text = function () {\n return this.nodeValue;\n };\n function HtmlNode(html) {\n this.html = html;\n }\n HtmlNode.prototype = {\n nodeName: '#html',\n attr: {},\n remove: function () {\n for (var index = 0; index < this.nodes.length; index++) {\n this.nodes[index].parentNode.removeChild(this.nodes[index]);\n }\n },\n render: function (parent, cached) {\n if (cached.nodeName !== this.nodeName || cached.html !== this.html) {\n cached.remove();\n var lastChild = parent.lastChild;\n insertHtml(parent, this.html);\n this.nodes = [];\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 var HTML_CONTAINER = document.createElement('div');\n function insertHtml(node, html) {\n HTML_CONTAINER.innerHTML = html;\n while (HTML_CONTAINER.firstChild) {\n node.appendChild(HTML_CONTAINER.firstChild);\n }\n }\n function html(value) {\n return new HtmlNode(value);\n }\n function element(nodeName, attrs, children) {\n return new Element(nodeName, attrs, children);\n }\n function text(value) {\n return new TextNode(value);\n }\n function Tree(root) {\n this.root = root;\n this.children = [];\n }\n Tree.prototype = {\n html: html,\n element: element,\n text: text,\n render: function (children) {\n var cachedChildren = this.children;\n var index;\n var length;\n for (index = 0, length = children.length; index < length; index++) {\n children[index].render(this.root, cachedChildren[index] || NULL_NODE);\n }\n for (index = length; index < cachedChildren.length; index++) {\n cachedChildren[index].remove();\n }\n this.children = children;\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 return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));"],"sourceRoot":"/source/"}