tfcconnection/.shadow-cljs/builds/app/dev/goog-js/goog.dom.dom.js

1 line
341 KiB
JavaScript

["^ ","~:resource-id",["~:shadow.build.classpath/resource","goog/dom/dom.js"],"~:js","goog.provide(\"goog.dom\");\ngoog.provide(\"goog.dom.Appendable\");\ngoog.provide(\"goog.dom.DomHelper\");\ngoog.require(\"goog.array\");\ngoog.require(\"goog.asserts\");\ngoog.require(\"goog.asserts.dom\");\ngoog.require(\"goog.dom.BrowserFeature\");\ngoog.require(\"goog.dom.NodeType\");\ngoog.require(\"goog.dom.TagName\");\ngoog.require(\"goog.dom.safe\");\ngoog.require(\"goog.html.SafeHtml\");\ngoog.require(\"goog.html.uncheckedconversions\");\ngoog.require(\"goog.math.Coordinate\");\ngoog.require(\"goog.math.Size\");\ngoog.require(\"goog.object\");\ngoog.require(\"goog.string\");\ngoog.require(\"goog.string.Const\");\ngoog.require(\"goog.string.Unicode\");\ngoog.require(\"goog.userAgent\");\ngoog.dom.ASSUME_QUIRKS_MODE = goog.define(\"goog.dom.ASSUME_QUIRKS_MODE\", false);\ngoog.dom.ASSUME_STANDARDS_MODE = goog.define(\"goog.dom.ASSUME_STANDARDS_MODE\", false);\ngoog.dom.COMPAT_MODE_KNOWN_ = goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE;\ngoog.dom.getDomHelper = function(opt_element) {\n return opt_element ? new goog.dom.DomHelper(goog.dom.getOwnerDocument(opt_element)) : goog.dom.defaultDomHelper_ || (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper());\n};\ngoog.dom.defaultDomHelper_;\ngoog.dom.getDocument = function() {\n return document;\n};\ngoog.dom.getElement = function(element) {\n return goog.dom.getElementHelper_(document, element);\n};\ngoog.dom.getHTMLElement = function(id) {\n const element = goog.dom.getElement(id);\n if (!element) {\n return null;\n }\n return goog.asserts.dom.assertIsHtmlElement(element);\n};\ngoog.dom.getElementHelper_ = function(doc, element) {\n return typeof element === \"string\" ? doc.getElementById(element) : element;\n};\ngoog.dom.getRequiredElement = function(id) {\n return goog.dom.getRequiredElementHelper_(document, id);\n};\ngoog.dom.getRequiredHTMLElement = function(id) {\n return goog.asserts.dom.assertIsHtmlElement(goog.dom.getRequiredElementHelper_(document, id));\n};\ngoog.dom.getRequiredElementHelper_ = function(doc, id) {\n goog.asserts.assertString(id);\n var element = goog.dom.getElementHelper_(doc, id);\n return goog.asserts.assert(element, \"No element found with id: \" + id);\n};\ngoog.dom.$ = goog.dom.getElement;\ngoog.dom.getElementsByTagName = function(tagName, opt_parent) {\n var parent = opt_parent || document;\n return parent.getElementsByTagName(String(tagName));\n};\ngoog.dom.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\n return goog.dom.getElementsByTagNameAndClass_(document, opt_tag, opt_class, opt_el);\n};\ngoog.dom.getElementByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\n return goog.dom.getElementByTagNameAndClass_(document, opt_tag, opt_class, opt_el);\n};\ngoog.dom.getElementsByClass = function(className, opt_el) {\n var parent = opt_el || document;\n if (goog.dom.canUseQuerySelector_(parent)) {\n return parent.querySelectorAll(\".\" + className);\n }\n return goog.dom.getElementsByTagNameAndClass_(document, \"*\", className, opt_el);\n};\ngoog.dom.getElementByClass = function(className, opt_el) {\n var parent = opt_el || document;\n var retVal = null;\n if (parent.getElementsByClassName) {\n retVal = parent.getElementsByClassName(className)[0];\n } else {\n retVal = goog.dom.getElementByTagNameAndClass_(document, \"*\", className, opt_el);\n }\n return retVal || null;\n};\ngoog.dom.getHTMLElementByClass = function(className, opt_parent) {\n const element = goog.dom.getElementByClass(className, opt_parent);\n if (!element) {\n return null;\n }\n return goog.asserts.dom.assertIsHtmlElement(element);\n};\ngoog.dom.getRequiredElementByClass = function(className, opt_root) {\n var retValue = goog.dom.getElementByClass(className, opt_root);\n return goog.asserts.assert(retValue, \"No element found with className: \" + className);\n};\ngoog.dom.getRequiredHTMLElementByClass = function(className, opt_parent) {\n const retValue = goog.dom.getElementByClass(className, opt_parent);\n goog.asserts.assert(retValue, \"No HTMLElement found with className: \" + className);\n return goog.asserts.dom.assertIsHtmlElement(retValue);\n};\ngoog.dom.canUseQuerySelector_ = function(parent) {\n return !!(parent.querySelectorAll && parent.querySelector);\n};\ngoog.dom.getElementsByTagNameAndClass_ = function(doc, opt_tag, opt_class, opt_el) {\n var parent = opt_el || doc;\n var tagName = opt_tag && opt_tag != \"*\" ? String(opt_tag).toUpperCase() : \"\";\n if (goog.dom.canUseQuerySelector_(parent) && (tagName || opt_class)) {\n var query = tagName + (opt_class ? \".\" + opt_class : \"\");\n return parent.querySelectorAll(query);\n }\n if (opt_class && parent.getElementsByClassName) {\n var els = parent.getElementsByClassName(opt_class);\n if (tagName) {\n var arrayLike = {};\n var len = 0;\n for (var i = 0, el; el = els[i]; i++) {\n if (tagName == el.nodeName) {\n arrayLike[len++] = el;\n }\n }\n arrayLike.length = len;\n return arrayLike;\n } else {\n return els;\n }\n }\n var els = parent.getElementsByTagName(tagName || \"*\");\n if (opt_class) {\n var arrayLike = {};\n var len = 0;\n for (var i = 0, el; el = els[i]; i++) {\n var className = el.className;\n if (typeof className.split == \"function\" && goog.array.contains(className.split(/\\s+/), opt_class)) {\n arrayLike[len++] = el;\n }\n }\n arrayLike.length = len;\n return arrayLike;\n } else {\n return els;\n }\n};\ngoog.dom.getElementByTagNameAndClass_ = function(doc, opt_tag, opt_class, opt_el) {\n var parent = opt_el || doc;\n var tag = opt_tag && opt_tag != \"*\" ? String(opt_tag).toUpperCase() : \"\";\n if (goog.dom.canUseQuerySelector_(parent) && (tag || opt_class)) {\n return parent.querySelector(tag + (opt_class ? \".\" + opt_class : \"\"));\n }\n var elements = goog.dom.getElementsByTagNameAndClass_(doc, opt_tag, opt_class, opt_el);\n return elements[0] || null;\n};\ngoog.dom.$$ = goog.dom.getElementsByTagNameAndClass;\ngoog.dom.setProperties = function(element, properties) {\n goog.object.forEach(properties, function(val, key) {\n if (val && typeof val == \"object\" && val.implementsGoogStringTypedString) {\n val = val.getTypedStringValue();\n }\n if (key == \"style\") {\n element.style.cssText = val;\n } else if (key == \"class\") {\n element.className = val;\n } else if (key == \"for\") {\n element.htmlFor = val;\n } else if (goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(key)) {\n element.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[key], val);\n } else if (goog.string.startsWith(key, \"aria-\") || goog.string.startsWith(key, \"data-\")) {\n element.setAttribute(key, val);\n } else {\n element[key] = val;\n }\n });\n};\ngoog.dom.DIRECT_ATTRIBUTE_MAP_ = {\"cellpadding\":\"cellPadding\", \"cellspacing\":\"cellSpacing\", \"colspan\":\"colSpan\", \"frameborder\":\"frameBorder\", \"height\":\"height\", \"maxlength\":\"maxLength\", \"nonce\":\"nonce\", \"role\":\"role\", \"rowspan\":\"rowSpan\", \"type\":\"type\", \"usemap\":\"useMap\", \"valign\":\"vAlign\", \"width\":\"width\"};\ngoog.dom.getViewportSize = function(opt_window) {\n return goog.dom.getViewportSize_(opt_window || window);\n};\ngoog.dom.getViewportSize_ = function(win) {\n var doc = win.document;\n var el = goog.dom.isCss1CompatMode_(doc) ? doc.documentElement : doc.body;\n return new goog.math.Size(el.clientWidth, el.clientHeight);\n};\ngoog.dom.getDocumentHeight = function() {\n return goog.dom.getDocumentHeight_(window);\n};\ngoog.dom.getDocumentHeightForWindow = function(win) {\n return goog.dom.getDocumentHeight_(win);\n};\ngoog.dom.getDocumentHeight_ = function(win) {\n var doc = win.document;\n var height = 0;\n if (doc) {\n var body = doc.body;\n var docEl = doc.documentElement;\n if (!(docEl && body)) {\n return 0;\n }\n var vh = goog.dom.getViewportSize_(win).height;\n if (goog.dom.isCss1CompatMode_(doc) && docEl.scrollHeight) {\n height = docEl.scrollHeight != vh ? docEl.scrollHeight : docEl.offsetHeight;\n } else {\n var sh = docEl.scrollHeight;\n var oh = docEl.offsetHeight;\n if (docEl.clientHeight != oh) {\n sh = body.scrollHeight;\n oh = body.offsetHeight;\n }\n if (sh > vh) {\n height = sh > oh ? sh : oh;\n } else {\n height = sh < oh ? sh : oh;\n }\n }\n }\n return height;\n};\ngoog.dom.getPageScroll = function(opt_window) {\n var win = opt_window || goog.global || window;\n return goog.dom.getDomHelper(win.document).getDocumentScroll();\n};\ngoog.dom.getDocumentScroll = function() {\n return goog.dom.getDocumentScroll_(document);\n};\ngoog.dom.getDocumentScroll_ = function(doc) {\n var el = goog.dom.getDocumentScrollElement_(doc);\n var win = goog.dom.getWindow_(doc);\n if (goog.userAgent.IE && win.pageYOffset != el.scrollTop) {\n return new goog.math.Coordinate(el.scrollLeft, el.scrollTop);\n }\n return new goog.math.Coordinate(win.pageXOffset || el.scrollLeft, win.pageYOffset || el.scrollTop);\n};\ngoog.dom.getDocumentScrollElement = function() {\n return goog.dom.getDocumentScrollElement_(document);\n};\ngoog.dom.getDocumentScrollElement_ = function(doc) {\n if (doc.scrollingElement) {\n return doc.scrollingElement;\n }\n if (!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(doc)) {\n return doc.documentElement;\n }\n return doc.body || doc.documentElement;\n};\ngoog.dom.getWindow = function(opt_doc) {\n return opt_doc ? goog.dom.getWindow_(opt_doc) : window;\n};\ngoog.dom.getWindow_ = function(doc) {\n return doc.parentWindow || doc.defaultView;\n};\ngoog.dom.createDom = function(tagName, opt_attributes, var_args) {\n return goog.dom.createDom_(document, arguments);\n};\ngoog.dom.createDom_ = function(doc, args) {\n var tagName = String(args[0]);\n var attributes = args[1];\n var element = goog.dom.createElement_(doc, tagName);\n if (attributes) {\n if (typeof attributes === \"string\") {\n element.className = attributes;\n } else if (Array.isArray(attributes)) {\n element.className = attributes.join(\" \");\n } else {\n goog.dom.setProperties(element, attributes);\n }\n }\n if (args.length > 2) {\n goog.dom.append_(doc, element, args, 2);\n }\n return element;\n};\ngoog.dom.append_ = function(doc, parent, args, startIndex) {\n function childHandler(child) {\n if (child) {\n parent.appendChild(typeof child === \"string\" ? doc.createTextNode(child) : child);\n }\n }\n for (var i = startIndex; i < args.length; i++) {\n var arg = args[i];\n if (goog.isArrayLike(arg) && !goog.dom.isNodeLike(arg)) {\n goog.array.forEach(goog.dom.isNodeList(arg) ? goog.array.toArray(arg) : arg, childHandler);\n } else {\n childHandler(arg);\n }\n }\n};\ngoog.dom.$dom = goog.dom.createDom;\ngoog.dom.createElement = function(name) {\n return goog.dom.createElement_(document, name);\n};\ngoog.dom.createElement_ = function(doc, name) {\n name = String(name);\n if (doc.contentType === \"application/xhtml+xml\") {\n name = name.toLowerCase();\n }\n return doc.createElement(name);\n};\ngoog.dom.createTextNode = function(content) {\n return document.createTextNode(String(content));\n};\ngoog.dom.createTable = function(rows, columns, opt_fillWithNbsp) {\n return goog.dom.createTable_(document, rows, columns, !!opt_fillWithNbsp);\n};\ngoog.dom.createTable_ = function(doc, rows, columns, fillWithNbsp) {\n var table = goog.dom.createElement_(doc, goog.dom.TagName.TABLE);\n var tbody = table.appendChild(goog.dom.createElement_(doc, goog.dom.TagName.TBODY));\n for (var i = 0; i < rows; i++) {\n var tr = goog.dom.createElement_(doc, goog.dom.TagName.TR);\n for (var j = 0; j < columns; j++) {\n var td = goog.dom.createElement_(doc, goog.dom.TagName.TD);\n if (fillWithNbsp) {\n goog.dom.setTextContent(td, goog.string.Unicode.NBSP);\n }\n tr.appendChild(td);\n }\n tbody.appendChild(tr);\n }\n return table;\n};\ngoog.dom.constHtmlToNode = function(var_args) {\n var stringArray = Array.prototype.map.call(arguments, goog.string.Const.unwrap);\n var safeHtml = goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from(\"Constant HTML string, that gets turned into a \" + \"Node later, so it will be automatically balanced.\"), stringArray.join(\"\"));\n return goog.dom.safeHtmlToNode(safeHtml);\n};\ngoog.dom.safeHtmlToNode = function(html) {\n return goog.dom.safeHtmlToNode_(document, html);\n};\ngoog.dom.safeHtmlToNode_ = function(doc, html) {\n var tempDiv = goog.dom.createElement_(doc, goog.dom.TagName.DIV);\n if (goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT) {\n goog.dom.safe.setInnerHtml(tempDiv, goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, html));\n tempDiv.removeChild(goog.asserts.assert(tempDiv.firstChild));\n } else {\n goog.dom.safe.setInnerHtml(tempDiv, html);\n }\n return goog.dom.childrenToNode_(doc, tempDiv);\n};\ngoog.dom.childrenToNode_ = function(doc, tempDiv) {\n if (tempDiv.childNodes.length == 1) {\n return tempDiv.removeChild(goog.asserts.assert(tempDiv.firstChild));\n } else {\n var fragment = doc.createDocumentFragment();\n while (tempDiv.firstChild) {\n fragment.appendChild(tempDiv.firstChild);\n }\n return fragment;\n }\n};\ngoog.dom.isCss1CompatMode = function() {\n return goog.dom.isCss1CompatMode_(document);\n};\ngoog.dom.isCss1CompatMode_ = function(doc) {\n if (goog.dom.COMPAT_MODE_KNOWN_) {\n return goog.dom.ASSUME_STANDARDS_MODE;\n }\n return doc.compatMode == \"CSS1Compat\";\n};\ngoog.dom.canHaveChildren = function(node) {\n if (node.nodeType != goog.dom.NodeType.ELEMENT) {\n return false;\n }\n switch(node.tagName) {\n case String(goog.dom.TagName.APPLET):\n case String(goog.dom.TagName.AREA):\n case String(goog.dom.TagName.BASE):\n case String(goog.dom.TagName.BR):\n case String(goog.dom.TagName.COL):\n case String(goog.dom.TagName.COMMAND):\n case String(goog.dom.TagName.EMBED):\n case String(goog.dom.TagName.FRAME):\n case String(goog.dom.TagName.HR):\n case String(goog.dom.TagName.IMG):\n case String(goog.dom.TagName.INPUT):\n case String(goog.dom.TagName.IFRAME):\n case String(goog.dom.TagName.ISINDEX):\n case String(goog.dom.TagName.KEYGEN):\n case String(goog.dom.TagName.LINK):\n case String(goog.dom.TagName.NOFRAMES):\n case String(goog.dom.TagName.NOSCRIPT):\n case String(goog.dom.TagName.META):\n case String(goog.dom.TagName.OBJECT):\n case String(goog.dom.TagName.PARAM):\n case String(goog.dom.TagName.SCRIPT):\n case String(goog.dom.TagName.SOURCE):\n case String(goog.dom.TagName.STYLE):\n case String(goog.dom.TagName.TRACK):\n case String(goog.dom.TagName.WBR):\n return false;\n }\n return true;\n};\ngoog.dom.appendChild = function(parent, child) {\n goog.asserts.assert(parent != null && child != null, \"goog.dom.appendChild expects non-null arguments\");\n parent.appendChild(child);\n};\ngoog.dom.append = function(parent, var_args) {\n goog.dom.append_(goog.dom.getOwnerDocument(parent), parent, arguments, 1);\n};\ngoog.dom.removeChildren = function(node) {\n var child;\n while (child = node.firstChild) {\n node.removeChild(child);\n }\n};\ngoog.dom.insertSiblingBefore = function(newNode, refNode) {\n goog.asserts.assert(newNode != null && refNode != null, \"goog.dom.insertSiblingBefore expects non-null arguments\");\n if (refNode.parentNode) {\n refNode.parentNode.insertBefore(newNode, refNode);\n }\n};\ngoog.dom.insertSiblingAfter = function(newNode, refNode) {\n goog.asserts.assert(newNode != null && refNode != null, \"goog.dom.insertSiblingAfter expects non-null arguments\");\n if (refNode.parentNode) {\n refNode.parentNode.insertBefore(newNode, refNode.nextSibling);\n }\n};\ngoog.dom.insertChildAt = function(parent, child, index) {\n goog.asserts.assert(parent != null, \"goog.dom.insertChildAt expects a non-null parent\");\n parent.insertBefore(child, parent.childNodes[index] || null);\n};\ngoog.dom.removeNode = function(node) {\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\n};\ngoog.dom.replaceNode = function(newNode, oldNode) {\n goog.asserts.assert(newNode != null && oldNode != null, \"goog.dom.replaceNode expects non-null arguments\");\n var parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n};\ngoog.dom.copyContents = function(target, source) {\n goog.asserts.assert(target != null && source != null, \"goog.dom.copyContents expects non-null arguments\");\n var childNodes = source.cloneNode(true).childNodes;\n goog.dom.removeChildren(target);\n while (childNodes.length) {\n target.appendChild(childNodes[0]);\n }\n};\ngoog.dom.flattenElement = function(element) {\n var child, parent = element.parentNode;\n if (parent && parent.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) {\n if (element.removeNode) {\n return element.removeNode(false);\n } else {\n while (child = element.firstChild) {\n parent.insertBefore(child, element);\n }\n return goog.dom.removeNode(element);\n }\n }\n};\ngoog.dom.getChildren = function(element) {\n if (element.children != undefined) {\n return element.children;\n }\n return Array.prototype.filter.call(element.childNodes, function(node) {\n return node.nodeType == goog.dom.NodeType.ELEMENT;\n });\n};\ngoog.dom.getFirstElementChild = function(node) {\n if (node.firstElementChild !== undefined) {\n return node.firstElementChild;\n }\n return goog.dom.getNextElementNode_(node.firstChild, true);\n};\ngoog.dom.getLastElementChild = function(node) {\n if (node.lastElementChild !== undefined) {\n return node.lastElementChild;\n }\n return goog.dom.getNextElementNode_(node.lastChild, false);\n};\ngoog.dom.getNextElementSibling = function(node) {\n if (node.nextElementSibling !== undefined) {\n return node.nextElementSibling;\n }\n return goog.dom.getNextElementNode_(node.nextSibling, true);\n};\ngoog.dom.getPreviousElementSibling = function(node) {\n if (node.previousElementSibling !== undefined) {\n return node.previousElementSibling;\n }\n return goog.dom.getNextElementNode_(node.previousSibling, false);\n};\ngoog.dom.getNextElementNode_ = function(node, forward) {\n while (node && node.nodeType != goog.dom.NodeType.ELEMENT) {\n node = forward ? node.nextSibling : node.previousSibling;\n }\n return node;\n};\ngoog.dom.getNextNode = function(node) {\n if (!node) {\n return null;\n }\n if (node.firstChild) {\n return node.firstChild;\n }\n while (node && !node.nextSibling) {\n node = node.parentNode;\n }\n return node ? node.nextSibling : null;\n};\ngoog.dom.getPreviousNode = function(node) {\n if (!node) {\n return null;\n }\n if (!node.previousSibling) {\n return node.parentNode;\n }\n node = node.previousSibling;\n while (node && node.lastChild) {\n node = node.lastChild;\n }\n return node;\n};\ngoog.dom.isNodeLike = function(obj) {\n return goog.isObject(obj) && obj.nodeType > 0;\n};\ngoog.dom.isElement = function(obj) {\n return goog.isObject(obj) && obj.nodeType == goog.dom.NodeType.ELEMENT;\n};\ngoog.dom.isWindow = function(obj) {\n return goog.isObject(obj) && obj[\"window\"] == obj;\n};\ngoog.dom.getParentElement = function(element) {\n var parent;\n if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY) {\n parent = element.parentElement;\n if (parent) {\n return parent;\n }\n }\n parent = element.parentNode;\n return goog.dom.isElement(parent) ? parent : null;\n};\ngoog.dom.contains = function(parent, descendant) {\n if (!parent || !descendant) {\n return false;\n }\n if (parent.contains && descendant.nodeType == goog.dom.NodeType.ELEMENT) {\n return parent == descendant || parent.contains(descendant);\n }\n if (typeof parent.compareDocumentPosition != \"undefined\") {\n return parent == descendant || Boolean(parent.compareDocumentPosition(descendant) & 16);\n }\n while (descendant && parent != descendant) {\n descendant = descendant.parentNode;\n }\n return descendant == parent;\n};\ngoog.dom.compareNodeOrder = function(node1, node2) {\n if (node1 == node2) {\n return 0;\n }\n if (node1.compareDocumentPosition) {\n return node1.compareDocumentPosition(node2) & 2 ? 1 : -1;\n }\n if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {\n if (node1.nodeType == goog.dom.NodeType.DOCUMENT) {\n return -1;\n }\n if (node2.nodeType == goog.dom.NodeType.DOCUMENT) {\n return 1;\n }\n }\n if (\"sourceIndex\" in node1 || node1.parentNode && \"sourceIndex\" in node1.parentNode) {\n var isElement1 = node1.nodeType == goog.dom.NodeType.ELEMENT;\n var isElement2 = node2.nodeType == goog.dom.NodeType.ELEMENT;\n if (isElement1 && isElement2) {\n return node1.sourceIndex - node2.sourceIndex;\n } else {\n var parent1 = node1.parentNode;\n var parent2 = node2.parentNode;\n if (parent1 == parent2) {\n return goog.dom.compareSiblingOrder_(node1, node2);\n }\n if (!isElement1 && goog.dom.contains(parent1, node2)) {\n return -1 * goog.dom.compareParentsDescendantNodeIe_(node1, node2);\n }\n if (!isElement2 && goog.dom.contains(parent2, node1)) {\n return goog.dom.compareParentsDescendantNodeIe_(node2, node1);\n }\n return (isElement1 ? node1.sourceIndex : parent1.sourceIndex) - (isElement2 ? node2.sourceIndex : parent2.sourceIndex);\n }\n }\n var doc = goog.dom.getOwnerDocument(node1);\n var range1, range2;\n range1 = doc.createRange();\n range1.selectNode(node1);\n range1.collapse(true);\n range2 = doc.createRange();\n range2.selectNode(node2);\n range2.collapse(true);\n return range1.compareBoundaryPoints(goog.global[\"Range\"].START_TO_END, range2);\n};\ngoog.dom.compareParentsDescendantNodeIe_ = function(textNode, node) {\n var parent = textNode.parentNode;\n if (parent == node) {\n return -1;\n }\n var sibling = node;\n while (sibling.parentNode != parent) {\n sibling = sibling.parentNode;\n }\n return goog.dom.compareSiblingOrder_(sibling, textNode);\n};\ngoog.dom.compareSiblingOrder_ = function(node1, node2) {\n var s = node2;\n while (s = s.previousSibling) {\n if (s == node1) {\n return -1;\n }\n }\n return 1;\n};\ngoog.dom.findCommonAncestor = function(var_args) {\n var i, count = arguments.length;\n if (!count) {\n return null;\n } else if (count == 1) {\n return arguments[0];\n }\n var paths = [];\n var minLength = Infinity;\n for (i = 0; i < count; i++) {\n var ancestors = [];\n var node = arguments[i];\n while (node) {\n ancestors.unshift(node);\n node = node.parentNode;\n }\n paths.push(ancestors);\n minLength = Math.min(minLength, ancestors.length);\n }\n var output = null;\n for (i = 0; i < minLength; i++) {\n var first = paths[0][i];\n for (var j = 1; j < count; j++) {\n if (first != paths[j][i]) {\n return output;\n }\n }\n output = first;\n }\n return output;\n};\ngoog.dom.isInDocument = function(node) {\n return (node.ownerDocument.compareDocumentPosition(node) & 16) == 16;\n};\ngoog.dom.getOwnerDocument = function(node) {\n goog.asserts.assert(node, \"Node cannot be null or undefined.\");\n return node.nodeType == goog.dom.NodeType.DOCUMENT ? node : node.ownerDocument || node.document;\n};\ngoog.dom.getFrameContentDocument = function(frame) {\n return frame.contentDocument || frame.contentWindow.document;\n};\ngoog.dom.getFrameContentWindow = function(frame) {\n try {\n return frame.contentWindow || (frame.contentDocument ? goog.dom.getWindow(frame.contentDocument) : null);\n } catch (e) {\n }\n return null;\n};\ngoog.dom.setTextContent = function(node, text) {\n goog.asserts.assert(node != null, \"goog.dom.setTextContent expects a non-null value for node\");\n if (\"textContent\" in node) {\n node.textContent = text;\n } else if (node.nodeType == goog.dom.NodeType.TEXT) {\n node.data = String(text);\n } else if (node.firstChild && node.firstChild.nodeType == goog.dom.NodeType.TEXT) {\n while (node.lastChild != node.firstChild) {\n node.removeChild(goog.asserts.assert(node.lastChild));\n }\n node.firstChild.data = String(text);\n } else {\n goog.dom.removeChildren(node);\n var doc = goog.dom.getOwnerDocument(node);\n node.appendChild(doc.createTextNode(String(text)));\n }\n};\ngoog.dom.getOuterHtml = function(element) {\n goog.asserts.assert(element !== null, \"goog.dom.getOuterHtml expects a non-null value for element\");\n if (\"outerHTML\" in element) {\n return element.outerHTML;\n } else {\n var doc = goog.dom.getOwnerDocument(element);\n var div = goog.dom.createElement_(doc, goog.dom.TagName.DIV);\n div.appendChild(element.cloneNode(true));\n return div.innerHTML;\n }\n};\ngoog.dom.findNode = function(root, p) {\n var rv = [];\n var found = goog.dom.findNodes_(root, p, rv, true);\n return found ? rv[0] : undefined;\n};\ngoog.dom.findNodes = function(root, p) {\n var rv = [];\n goog.dom.findNodes_(root, p, rv, false);\n return rv;\n};\ngoog.dom.findNodes_ = function(root, p, rv, findOne) {\n if (root != null) {\n var child = root.firstChild;\n while (child) {\n if (p(child)) {\n rv.push(child);\n if (findOne) {\n return true;\n }\n }\n if (goog.dom.findNodes_(child, p, rv, findOne)) {\n return true;\n }\n child = child.nextSibling;\n }\n }\n return false;\n};\ngoog.dom.findElement = function(root, pred) {\n var stack = goog.dom.getChildrenReverse_(root);\n while (stack.length > 0) {\n var next = stack.pop();\n if (pred(next)) {\n return next;\n }\n for (var c = next.lastElementChild; c; c = c.previousElementSibling) {\n stack.push(c);\n }\n }\n return null;\n};\ngoog.dom.findElements = function(root, pred) {\n var result = [], stack = goog.dom.getChildrenReverse_(root);\n while (stack.length > 0) {\n var next = stack.pop();\n if (pred(next)) {\n result.push(next);\n }\n for (var c = next.lastElementChild; c; c = c.previousElementSibling) {\n stack.push(c);\n }\n }\n return result;\n};\ngoog.dom.getChildrenReverse_ = function(node) {\n if (node.nodeType == goog.dom.NodeType.DOCUMENT) {\n return [node.documentElement];\n } else {\n var children = [];\n for (var c = node.lastElementChild; c; c = c.previousElementSibling) {\n children.push(c);\n }\n return children;\n }\n};\ngoog.dom.TAGS_TO_IGNORE_ = {\"SCRIPT\":1, \"STYLE\":1, \"HEAD\":1, \"IFRAME\":1, \"OBJECT\":1};\ngoog.dom.PREDEFINED_TAG_VALUES_ = {\"IMG\":\" \", \"BR\":\"\\n\"};\ngoog.dom.isFocusableTabIndex = function(element) {\n return goog.dom.hasSpecifiedTabIndex_(element) && goog.dom.isTabIndexFocusable_(element);\n};\ngoog.dom.setFocusableTabIndex = function(element, enable) {\n if (enable) {\n element.tabIndex = 0;\n } else {\n element.tabIndex = -1;\n element.removeAttribute(\"tabIndex\");\n }\n};\ngoog.dom.isFocusable = function(element) {\n var focusable;\n if (goog.dom.nativelySupportsFocus_(element)) {\n focusable = !element.disabled && (!goog.dom.hasSpecifiedTabIndex_(element) || goog.dom.isTabIndexFocusable_(element));\n } else {\n focusable = goog.dom.isFocusableTabIndex(element);\n }\n return focusable && goog.userAgent.IE ? goog.dom.hasNonZeroBoundingRect_(element) : focusable;\n};\ngoog.dom.hasSpecifiedTabIndex_ = function(element) {\n return element.hasAttribute(\"tabindex\");\n};\ngoog.dom.isTabIndexFocusable_ = function(element) {\n var index = element.tabIndex;\n return typeof index === \"number\" && index >= 0 && index < 32768;\n};\ngoog.dom.nativelySupportsFocus_ = function(element) {\n return element.tagName == goog.dom.TagName.A && element.hasAttribute(\"href\") || element.tagName == goog.dom.TagName.INPUT || element.tagName == goog.dom.TagName.TEXTAREA || element.tagName == goog.dom.TagName.SELECT || element.tagName == goog.dom.TagName.BUTTON;\n};\ngoog.dom.hasNonZeroBoundingRect_ = function(element) {\n var rect;\n if (typeof element[\"getBoundingClientRect\"] !== \"function\" || goog.userAgent.IE && element.parentElement == null) {\n rect = {\"height\":element.offsetHeight, \"width\":element.offsetWidth};\n } else {\n rect = element.getBoundingClientRect();\n }\n return rect != null && rect.height > 0 && rect.width > 0;\n};\ngoog.dom.getTextContent = function(node) {\n var textContent;\n var buf = [];\n goog.dom.getTextContent_(node, buf, true);\n textContent = buf.join(\"\");\n textContent = textContent.replace(/ \\xAD /g, \" \").replace(/\\xAD/g, \"\");\n textContent = textContent.replace(/\\u200B/g, \"\");\n textContent = textContent.replace(/ +/g, \" \");\n if (textContent != \" \") {\n textContent = textContent.replace(/^\\s*/, \"\");\n }\n return textContent;\n};\ngoog.dom.getRawTextContent = function(node) {\n var buf = [];\n goog.dom.getTextContent_(node, buf, false);\n return buf.join(\"\");\n};\ngoog.dom.getTextContent_ = function(node, buf, normalizeWhitespace) {\n if (node.nodeName in goog.dom.TAGS_TO_IGNORE_) {\n } else if (node.nodeType == goog.dom.NodeType.TEXT) {\n if (normalizeWhitespace) {\n buf.push(String(node.nodeValue).replace(/(\\r\\n|\\r|\\n)/g, \"\"));\n } else {\n buf.push(node.nodeValue);\n }\n } else if (node.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {\n buf.push(goog.dom.PREDEFINED_TAG_VALUES_[node.nodeName]);\n } else {\n var child = node.firstChild;\n while (child) {\n goog.dom.getTextContent_(child, buf, normalizeWhitespace);\n child = child.nextSibling;\n }\n }\n};\ngoog.dom.getNodeTextLength = function(node) {\n return goog.dom.getTextContent(node).length;\n};\ngoog.dom.getNodeTextOffset = function(node, opt_offsetParent) {\n var root = opt_offsetParent || goog.dom.getOwnerDocument(node).body;\n var buf = [];\n while (node && node != root) {\n var cur = node;\n while (cur = cur.previousSibling) {\n buf.unshift(goog.dom.getTextContent(cur));\n }\n node = node.parentNode;\n }\n return goog.string.trimLeft(buf.join(\"\")).replace(/ +/g, \" \").length;\n};\ngoog.dom.getNodeAtOffset = function(parent, offset, opt_result) {\n var stack = [parent], pos = 0, cur = null;\n while (stack.length > 0 && pos < offset) {\n cur = stack.pop();\n if (cur.nodeName in goog.dom.TAGS_TO_IGNORE_) {\n } else if (cur.nodeType == goog.dom.NodeType.TEXT) {\n var text = cur.nodeValue.replace(/(\\r\\n|\\r|\\n)/g, \"\").replace(/ +/g, \" \");\n pos += text.length;\n } else if (cur.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {\n pos += goog.dom.PREDEFINED_TAG_VALUES_[cur.nodeName].length;\n } else {\n for (var i = cur.childNodes.length - 1; i >= 0; i--) {\n stack.push(cur.childNodes[i]);\n }\n }\n }\n if (goog.isObject(opt_result)) {\n opt_result.remainder = cur ? cur.nodeValue.length + offset - pos - 1 : 0;\n opt_result.node = cur;\n }\n return cur;\n};\ngoog.dom.isNodeList = function(val) {\n if (val && typeof val.length == \"number\") {\n if (goog.isObject(val)) {\n return typeof val.item == \"function\" || typeof val.item == \"string\";\n } else if (typeof val === \"function\") {\n return typeof val.item == \"function\";\n }\n }\n return false;\n};\ngoog.dom.getAncestorByTagNameAndClass = function(element, opt_tag, opt_class, opt_maxSearchSteps) {\n if (!opt_tag && !opt_class) {\n return null;\n }\n var tagName = opt_tag ? String(opt_tag).toUpperCase() : null;\n return goog.dom.getAncestor(element, function(node) {\n return (!tagName || node.nodeName == tagName) && (!opt_class || typeof node.className === \"string\" && goog.array.contains(node.className.split(/\\s+/), opt_class));\n }, true, opt_maxSearchSteps);\n};\ngoog.dom.getAncestorByClass = function(element, className, opt_maxSearchSteps) {\n return goog.dom.getAncestorByTagNameAndClass(element, null, className, opt_maxSearchSteps);\n};\ngoog.dom.getAncestor = function(element, matcher, opt_includeNode, opt_maxSearchSteps) {\n if (element && !opt_includeNode) {\n element = element.parentNode;\n }\n var steps = 0;\n while (element && (opt_maxSearchSteps == null || steps <= opt_maxSearchSteps)) {\n goog.asserts.assert(element.name != \"parentNode\");\n if (matcher(element)) {\n return element;\n }\n element = element.parentNode;\n steps++;\n }\n return null;\n};\ngoog.dom.getActiveElement = function(doc) {\n try {\n var activeElement = doc && doc.activeElement;\n return activeElement && activeElement.nodeName ? activeElement : null;\n } catch (e) {\n return null;\n }\n};\ngoog.dom.getPixelRatio = function() {\n var win = goog.dom.getWindow();\n if (win.devicePixelRatio !== undefined) {\n return win.devicePixelRatio;\n } else if (win.matchMedia) {\n return goog.dom.matchesPixelRatio_(3) || goog.dom.matchesPixelRatio_(2) || goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(1) || .75;\n }\n return 1;\n};\ngoog.dom.matchesPixelRatio_ = function(pixelRatio) {\n var win = goog.dom.getWindow();\n var dpiPerDppx = 96;\n var query = \"(min-resolution: \" + pixelRatio + \"dppx),\" + \"(min--moz-device-pixel-ratio: \" + pixelRatio + \"),\" + \"(min-resolution: \" + pixelRatio * dpiPerDppx + \"dpi)\";\n return win.matchMedia(query).matches ? pixelRatio : 0;\n};\ngoog.dom.getCanvasContext2D = function(canvas) {\n return canvas.getContext(\"2d\");\n};\ngoog.dom.DomHelper = function(opt_document) {\n this.document_ = opt_document || goog.global.document || document;\n};\ngoog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper;\ngoog.dom.DomHelper.prototype.setDocument = function(document) {\n this.document_ = document;\n};\ngoog.dom.DomHelper.prototype.getDocument = function() {\n return this.document_;\n};\ngoog.dom.DomHelper.prototype.getElement = function(element) {\n return goog.dom.getElementHelper_(this.document_, element);\n};\ngoog.dom.DomHelper.prototype.getRequiredElement = function(id) {\n return goog.dom.getRequiredElementHelper_(this.document_, id);\n};\ngoog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;\ngoog.dom.DomHelper.prototype.getElementsByTagName = function(tagName, opt_parent) {\n var parent = opt_parent || this.document_;\n return parent.getElementsByTagName(String(tagName));\n};\ngoog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\n return goog.dom.getElementsByTagNameAndClass_(this.document_, opt_tag, opt_class, opt_el);\n};\ngoog.dom.DomHelper.prototype.getElementByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\n return goog.dom.getElementByTagNameAndClass_(this.document_, opt_tag, opt_class, opt_el);\n};\ngoog.dom.DomHelper.prototype.getElementsByClass = function(className, opt_el) {\n var doc = opt_el || this.document_;\n return goog.dom.getElementsByClass(className, doc);\n};\ngoog.dom.DomHelper.prototype.getElementByClass = function(className, opt_el) {\n var doc = opt_el || this.document_;\n return goog.dom.getElementByClass(className, doc);\n};\ngoog.dom.DomHelper.prototype.getRequiredElementByClass = function(className, opt_root) {\n var root = opt_root || this.document_;\n return goog.dom.getRequiredElementByClass(className, root);\n};\ngoog.dom.DomHelper.prototype.$$ = goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;\ngoog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties;\ngoog.dom.DomHelper.prototype.getViewportSize = function(opt_window) {\n return goog.dom.getViewportSize(opt_window || this.getWindow());\n};\ngoog.dom.DomHelper.prototype.getDocumentHeight = function() {\n return goog.dom.getDocumentHeight_(this.getWindow());\n};\ngoog.dom.Appendable;\ngoog.dom.DomHelper.prototype.createDom = function(tagName, opt_attributes, var_args) {\n return goog.dom.createDom_(this.document_, arguments);\n};\ngoog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;\ngoog.dom.DomHelper.prototype.createElement = function(name) {\n return goog.dom.createElement_(this.document_, name);\n};\ngoog.dom.DomHelper.prototype.createTextNode = function(content) {\n return this.document_.createTextNode(String(content));\n};\ngoog.dom.DomHelper.prototype.createTable = function(rows, columns, opt_fillWithNbsp) {\n return goog.dom.createTable_(this.document_, rows, columns, !!opt_fillWithNbsp);\n};\ngoog.dom.DomHelper.prototype.safeHtmlToNode = function(html) {\n return goog.dom.safeHtmlToNode_(this.document_, html);\n};\ngoog.dom.DomHelper.prototype.isCss1CompatMode = function() {\n return goog.dom.isCss1CompatMode_(this.document_);\n};\ngoog.dom.DomHelper.prototype.getWindow = function() {\n return goog.dom.getWindow_(this.document_);\n};\ngoog.dom.DomHelper.prototype.getDocumentScrollElement = function() {\n return goog.dom.getDocumentScrollElement_(this.document_);\n};\ngoog.dom.DomHelper.prototype.getDocumentScroll = function() {\n return goog.dom.getDocumentScroll_(this.document_);\n};\ngoog.dom.DomHelper.prototype.getActiveElement = function(opt_doc) {\n return goog.dom.getActiveElement(opt_doc || this.document_);\n};\ngoog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild;\ngoog.dom.DomHelper.prototype.append = goog.dom.append;\ngoog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren;\ngoog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren;\ngoog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore;\ngoog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter;\ngoog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt;\ngoog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode;\ngoog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode;\ngoog.dom.DomHelper.prototype.copyContents = goog.dom.copyContents;\ngoog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement;\ngoog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren;\ngoog.dom.DomHelper.prototype.getFirstElementChild = goog.dom.getFirstElementChild;\ngoog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild;\ngoog.dom.DomHelper.prototype.getNextElementSibling = goog.dom.getNextElementSibling;\ngoog.dom.DomHelper.prototype.getPreviousElementSibling = goog.dom.getPreviousElementSibling;\ngoog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode;\ngoog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode;\ngoog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike;\ngoog.dom.DomHelper.prototype.isElement = goog.dom.isElement;\ngoog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow;\ngoog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement;\ngoog.dom.DomHelper.prototype.contains = goog.dom.contains;\ngoog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder;\ngoog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor;\ngoog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument;\ngoog.dom.DomHelper.prototype.getFrameContentDocument = goog.dom.getFrameContentDocument;\ngoog.dom.DomHelper.prototype.getFrameContentWindow = goog.dom.getFrameContentWindow;\ngoog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent;\ngoog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml;\ngoog.dom.DomHelper.prototype.findNode = goog.dom.findNode;\ngoog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes;\ngoog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex;\ngoog.dom.DomHelper.prototype.setFocusableTabIndex = goog.dom.setFocusableTabIndex;\ngoog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable;\ngoog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent;\ngoog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength;\ngoog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset;\ngoog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset;\ngoog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList;\ngoog.dom.DomHelper.prototype.getAncestorByTagNameAndClass = goog.dom.getAncestorByTagNameAndClass;\ngoog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass;\ngoog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor;\ngoog.dom.DomHelper.prototype.getCanvasContext2D = goog.dom.getCanvasContext2D;\n","~:source","/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Utilities for manipulating the browser's Document Object Model\n * Inspiration taken *heavily* from mochikit (http://mochikit.com/).\n *\n * You can use {@link goog.dom.DomHelper} to create new dom helpers that refer\n * to a different document object. This is useful if you are working with\n * frames or multiple windows.\n *\n * @suppress {strictMissingProperties}\n */\n\n\n// TODO(arv): Rename/refactor getTextContent and getRawTextContent. The problem\n// is that getTextContent should mimic the DOM3 textContent. We should add a\n// getInnerText (or getText) which tries to return the visible text, innerText.\n\n\ngoog.provide('goog.dom');\ngoog.provide('goog.dom.Appendable');\ngoog.provide('goog.dom.DomHelper');\n\ngoog.require('goog.array');\ngoog.require('goog.asserts');\ngoog.require('goog.asserts.dom');\ngoog.require('goog.dom.BrowserFeature');\ngoog.require('goog.dom.NodeType');\ngoog.require('goog.dom.TagName');\ngoog.require('goog.dom.safe');\ngoog.require('goog.html.SafeHtml');\ngoog.require('goog.html.uncheckedconversions');\ngoog.require('goog.math.Coordinate');\ngoog.require('goog.math.Size');\ngoog.require('goog.object');\ngoog.require('goog.string');\ngoog.require('goog.string.Const');\ngoog.require('goog.string.Unicode');\ngoog.require('goog.userAgent');\n\n\n/**\n * @define {boolean} Whether we know at compile time that the browser is in\n * quirks mode.\n */\ngoog.dom.ASSUME_QUIRKS_MODE = goog.define('goog.dom.ASSUME_QUIRKS_MODE', false);\n\n\n/**\n * @define {boolean} Whether we know at compile time that the browser is in\n * standards compliance mode.\n */\ngoog.dom.ASSUME_STANDARDS_MODE =\n goog.define('goog.dom.ASSUME_STANDARDS_MODE', false);\n\n\n/**\n * Whether we know the compatibility mode at compile time.\n * @type {boolean}\n * @private\n */\ngoog.dom.COMPAT_MODE_KNOWN_ =\n goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE;\n\n\n/**\n * Gets the DomHelper object for the document where the element resides.\n * @param {(Node|Window)=} opt_element If present, gets the DomHelper for this\n * element.\n * @return {!goog.dom.DomHelper} The DomHelper.\n */\ngoog.dom.getDomHelper = function(opt_element) {\n 'use strict';\n return opt_element ?\n new goog.dom.DomHelper(goog.dom.getOwnerDocument(opt_element)) :\n (goog.dom.defaultDomHelper_ ||\n (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper()));\n};\n\n\n/**\n * Cached default DOM helper.\n * @type {!goog.dom.DomHelper|undefined}\n * @private\n */\ngoog.dom.defaultDomHelper_;\n\n\n/**\n * Gets the document object being used by the dom library.\n * @return {!Document} Document object.\n */\ngoog.dom.getDocument = function() {\n 'use strict';\n return document;\n};\n\n\n/**\n * Gets an element from the current document by element id.\n *\n * If an Element is passed in, it is returned.\n *\n * @param {string|Element} element Element ID or a DOM node.\n * @return {Element} The element with the given ID, or the node passed in.\n */\ngoog.dom.getElement = function(element) {\n 'use strict';\n return goog.dom.getElementHelper_(document, element);\n};\n\n\n/**\n * Gets an HTML element from the current document by element id.\n *\n * @param {string} id\n * @return {?HTMLElement} The element with the given ID or null if no such\n * element exists.\n */\ngoog.dom.getHTMLElement = function(id) {\n 'use strict'\n const element = goog.dom.getElement(id);\n if (!element) {\n return null;\n }\n return goog.asserts.dom.assertIsHtmlElement(element);\n};\n\n\n/**\n * Gets an element by id from the given document (if present).\n * If an element is given, it is returned.\n * @param {!Document} doc\n * @param {string|Element} element Element ID or a DOM node.\n * @return {Element} The resulting element.\n * @private\n */\ngoog.dom.getElementHelper_ = function(doc, element) {\n 'use strict';\n return typeof element === 'string' ? doc.getElementById(element) : element;\n};\n\n\n/**\n * Gets an element by id, asserting that the element is found.\n *\n * This is used when an element is expected to exist, and should fail with\n * an assertion error if it does not (if assertions are enabled).\n *\n * @param {string} id Element ID.\n * @return {!Element} The element with the given ID, if it exists.\n */\ngoog.dom.getRequiredElement = function(id) {\n 'use strict';\n return goog.dom.getRequiredElementHelper_(document, id);\n};\n\n\n/**\n * Gets an HTML element by id, asserting that the element is found.\n *\n * This is used when an element is expected to exist, and should fail with\n * an assertion error if it does not (if assertions are enabled).\n *\n * @param {string} id Element ID.\n * @return {!HTMLElement} The element with the given ID, if it exists.\n */\ngoog.dom.getRequiredHTMLElement = function(id) {\n 'use strict'\n return goog.asserts.dom.assertIsHtmlElement(\n goog.dom.getRequiredElementHelper_(document, id));\n};\n\n\n/**\n * Helper function for getRequiredElementHelper functions, both static and\n * on DomHelper. Asserts the element with the given id exists.\n * @param {!Document} doc\n * @param {string} id\n * @return {!Element} The element with the given ID, if it exists.\n * @private\n */\ngoog.dom.getRequiredElementHelper_ = function(doc, id) {\n 'use strict';\n // To prevent users passing in Elements as is permitted in getElement().\n goog.asserts.assertString(id);\n var element = goog.dom.getElementHelper_(doc, id);\n return goog.asserts.assert(element, 'No element found with id: ' + id);\n};\n\n\n/**\n * Alias for getElement.\n * @param {string|Element} element Element ID or a DOM node.\n * @return {Element} The element with the given ID, or the node passed in.\n * @deprecated Use {@link goog.dom.getElement} instead.\n */\ngoog.dom.$ = goog.dom.getElement;\n\n\n/**\n * Gets elements by tag name.\n * @param {!goog.dom.TagName<T>} tagName\n * @param {(!Document|!Element)=} opt_parent Parent element or document where to\n * look for elements. Defaults to document.\n * @return {!NodeList<R>} List of elements. The members of the list are\n * {!Element} if tagName is not a member of goog.dom.TagName or more\n * specific types if it is (e.g. {!HTMLAnchorElement} for\n * goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.getElementsByTagName = function(tagName, opt_parent) {\n 'use strict';\n var parent = opt_parent || document;\n return parent.getElementsByTagName(String(tagName));\n};\n\n\n/**\n * Looks up elements by both tag and class name, using browser native functions\n * (`querySelectorAll`, `getElementsByTagName` or\n * `getElementsByClassName`) where possible. This function\n * is a useful, if limited, way of collecting a list of DOM elements\n * with certain characteristics. `querySelectorAll` offers a\n * more powerful and general solution which allows matching on CSS3\n * selector expressions.\n *\n * Note that tag names are case sensitive in the SVG namespace, and this\n * function converts opt_tag to uppercase for comparisons. For queries in the\n * SVG namespace you should use querySelector or querySelectorAll instead.\n * https://bugzilla.mozilla.org/show_bug.cgi?id=963870\n * https://bugs.webkit.org/show_bug.cgi?id=83438\n *\n * @see {https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll}\n *\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\n * @param {?string=} opt_class Optional class name.\n * @param {(Document|Element)=} opt_el Optional element to look in.\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\n * and numerical indices are guaranteed to exist). The members of the array\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\n * specific types if it is (e.g. {!HTMLAnchorElement} for\n * goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\n 'use strict';\n return goog.dom.getElementsByTagNameAndClass_(\n document, opt_tag, opt_class, opt_el);\n};\n\n\n/**\n * Gets the first element matching the tag and the class.\n *\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\n * @param {?string=} opt_class Optional class name.\n * @param {(Document|Element)=} opt_el Optional element to look in.\n * @return {?R} Reference to a DOM node. The return type is {?Element} if\n * tagName is a string or a more specific type if it is a member of\n * goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.getElementByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\n 'use strict';\n return goog.dom.getElementByTagNameAndClass_(\n document, opt_tag, opt_class, opt_el);\n};\n\n\n/**\n * Returns a static, array-like list of the elements with the provided\n * className.\n *\n * @param {string} className the name of the class to look for.\n * @param {(Document|Element)=} opt_el Optional element to look in.\n * @return {!IArrayLike<!Element>} The items found with the class name provided.\n */\ngoog.dom.getElementsByClass = function(className, opt_el) {\n 'use strict';\n var parent = opt_el || document;\n if (goog.dom.canUseQuerySelector_(parent)) {\n return parent.querySelectorAll('.' + className);\n }\n return goog.dom.getElementsByTagNameAndClass_(\n document, '*', className, opt_el);\n};\n\n\n/**\n * Returns the first element with the provided className.\n *\n * @param {string} className the name of the class to look for.\n * @param {Element|Document=} opt_el Optional element to look in.\n * @return {Element} The first item with the class name provided.\n */\ngoog.dom.getElementByClass = function(className, opt_el) {\n 'use strict';\n var parent = opt_el || document;\n var retVal = null;\n if (parent.getElementsByClassName) {\n retVal = parent.getElementsByClassName(className)[0];\n } else {\n retVal =\n goog.dom.getElementByTagNameAndClass_(document, '*', className, opt_el);\n }\n return retVal || null;\n};\n\n\n/**\n * Returns the first element with the provided className and asserts that it is\n * an HTML element.\n *\n * @param {string} className the name of the class to look for.\n * @param {!Element|!Document=} opt_parent Optional element to look in.\n * @return {?HTMLElement} The first item with the class name provided.\n */\ngoog.dom.getHTMLElementByClass = function(className, opt_parent) {\n 'use strict'\n const element = goog.dom.getElementByClass(className, opt_parent);\n if (!element) {\n return null;\n }\n return goog.asserts.dom.assertIsHtmlElement(element);\n};\n\n\n/**\n * Ensures an element with the given className exists, and then returns the\n * first element with the provided className.\n *\n * @param {string} className the name of the class to look for.\n * @param {!Element|!Document=} opt_root Optional element or document to look\n * in.\n * @return {!Element} The first item with the class name provided.\n * @throws {goog.asserts.AssertionError} Thrown if no element is found.\n */\ngoog.dom.getRequiredElementByClass = function(className, opt_root) {\n 'use strict';\n var retValue = goog.dom.getElementByClass(className, opt_root);\n return goog.asserts.assert(\n retValue, 'No element found with className: ' + className);\n};\n\n\n/**\n * Ensures an element with the given className exists, and then returns the\n * first element with the provided className after asserting that it is an\n * HTML element.\n *\n * @param {string} className the name of the class to look for.\n * @param {!Element|!Document=} opt_parent Optional element or document to look\n * in.\n * @return {!HTMLElement} The first item with the class name provided.\n */\ngoog.dom.getRequiredHTMLElementByClass = function(className, opt_parent) {\n 'use strict'\n const retValue = goog.dom.getElementByClass(className, opt_parent);\n goog.asserts.assert(\n retValue, 'No HTMLElement found with className: ' + className);\n return goog.asserts.dom.assertIsHtmlElement(retValue);\n};\n\n\n/**\n * Prefer the standardized (http://www.w3.org/TR/selectors-api/), native and\n * fast W3C Selectors API.\n * @param {!(Element|Document)} parent The parent document object.\n * @return {boolean} whether or not we can use parent.querySelector* APIs.\n * @private\n */\ngoog.dom.canUseQuerySelector_ = function(parent) {\n 'use strict';\n return !!(parent.querySelectorAll && parent.querySelector);\n};\n\n\n/**\n * Helper for `getElementsByTagNameAndClass`.\n * @param {!Document} doc The document to get the elements in.\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\n * @param {?string=} opt_class Optional class name.\n * @param {(Document|Element)=} opt_el Optional element to look in.\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\n * and numerical indices are guaranteed to exist). The members of the array\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\n * specific types if it is (e.g. {!HTMLAnchorElement} for\n * goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n * @private\n */\ngoog.dom.getElementsByTagNameAndClass_ = function(\n doc, opt_tag, opt_class, opt_el) {\n 'use strict';\n var parent = opt_el || doc;\n var tagName =\n (opt_tag && opt_tag != '*') ? String(opt_tag).toUpperCase() : '';\n\n if (goog.dom.canUseQuerySelector_(parent) && (tagName || opt_class)) {\n var query = tagName + (opt_class ? '.' + opt_class : '');\n return parent.querySelectorAll(query);\n }\n\n // Use the native getElementsByClassName if available, under the assumption\n // that even when the tag name is specified, there will be fewer elements to\n // filter through when going by class than by tag name\n if (opt_class && parent.getElementsByClassName) {\n var els = parent.getElementsByClassName(opt_class);\n\n if (tagName) {\n var arrayLike = {};\n var len = 0;\n\n // Filter for specific tags if requested.\n for (var i = 0, el; el = els[i]; i++) {\n if (tagName == el.nodeName) {\n arrayLike[len++] = el;\n }\n }\n arrayLike.length = len;\n\n return /** @type {!IArrayLike<!Element>} */ (arrayLike);\n } else {\n return els;\n }\n }\n\n var els = parent.getElementsByTagName(tagName || '*');\n\n if (opt_class) {\n var arrayLike = {};\n var len = 0;\n for (var i = 0, el; el = els[i]; i++) {\n var className = el.className;\n // Check if className has a split function since SVG className does not.\n if (typeof className.split == 'function' &&\n goog.array.contains(className.split(/\\s+/), opt_class)) {\n arrayLike[len++] = el;\n }\n }\n arrayLike.length = len;\n return /** @type {!IArrayLike<!Element>} */ (arrayLike);\n } else {\n return els;\n }\n};\n\n\n/**\n * Helper for goog.dom.getElementByTagNameAndClass.\n *\n * @param {!Document} doc The document to get the elements in.\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\n * @param {?string=} opt_class Optional class name.\n * @param {(Document|Element)=} opt_el Optional element to look in.\n * @return {?R} Reference to a DOM node. The return type is {?Element} if\n * tagName is a string or a more specific type if it is a member of\n * goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n * @private\n */\ngoog.dom.getElementByTagNameAndClass_ = function(\n doc, opt_tag, opt_class, opt_el) {\n 'use strict';\n var parent = opt_el || doc;\n var tag = (opt_tag && opt_tag != '*') ? String(opt_tag).toUpperCase() : '';\n if (goog.dom.canUseQuerySelector_(parent) && (tag || opt_class)) {\n return parent.querySelector(tag + (opt_class ? '.' + opt_class : ''));\n }\n var elements =\n goog.dom.getElementsByTagNameAndClass_(doc, opt_tag, opt_class, opt_el);\n return elements[0] || null;\n};\n\n\n\n/**\n * Alias for `getElementsByTagNameAndClass`.\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\n * @param {?string=} opt_class Optional class name.\n * @param {Element=} opt_el Optional element to look in.\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\n * and numerical indices are guaranteed to exist). The members of the array\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\n * specific types if it is (e.g. {!HTMLAnchorElement} for\n * goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n * @deprecated Use {@link goog.dom.getElementsByTagNameAndClass} instead.\n */\ngoog.dom.$$ = goog.dom.getElementsByTagNameAndClass;\n\n\n/**\n * Sets multiple properties, and sometimes attributes, on an element. Note that\n * properties are simply object properties on the element instance, while\n * attributes are visible in the DOM. Many properties map to attributes with the\n * same names, some with different names, and there are also unmappable cases.\n *\n * This method sets properties by default (which means that custom attributes\n * are not supported). These are the exeptions (some of which is legacy):\n * - \"style\": Even though this is an attribute name, it is translated to a\n * property, \"style.cssText\". Note that this property sanitizes and formats\n * its value, unlike the attribute.\n * - \"class\": This is an attribute name, it is translated to the \"className\"\n * property.\n * - \"for\": This is an attribute name, it is translated to the \"htmlFor\"\n * property.\n * - Entries in {@see goog.dom.DIRECT_ATTRIBUTE_MAP_} are set as attributes,\n * this is probably due to browser quirks.\n * - \"aria-*\", \"data-*\": Always set as attributes, they have no property\n * counterparts.\n *\n * @param {Element} element DOM node to set properties on.\n * @param {Object} properties Hash of property:value pairs.\n * Property values can be strings or goog.string.TypedString values (such as\n * goog.html.SafeUrl).\n */\ngoog.dom.setProperties = function(element, properties) {\n 'use strict';\n goog.object.forEach(properties, function(val, key) {\n 'use strict';\n if (val && typeof val == 'object' && val.implementsGoogStringTypedString) {\n val = val.getTypedStringValue();\n }\n if (key == 'style') {\n element.style.cssText = val;\n } else if (key == 'class') {\n element.className = val;\n } else if (key == 'for') {\n element.htmlFor = val;\n } else if (goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(key)) {\n element.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[key], val);\n } else if (\n goog.string.startsWith(key, 'aria-') ||\n goog.string.startsWith(key, 'data-')) {\n element.setAttribute(key, val);\n } else {\n element[key] = val;\n }\n });\n};\n\n\n/**\n * Map of attributes that should be set using\n * element.setAttribute(key, val) instead of element[key] = val. Used\n * by goog.dom.setProperties.\n *\n * @private {!Object<string, string>}\n * @const\n */\ngoog.dom.DIRECT_ATTRIBUTE_MAP_ = {\n 'cellpadding': 'cellPadding',\n 'cellspacing': 'cellSpacing',\n 'colspan': 'colSpan',\n 'frameborder': 'frameBorder',\n 'height': 'height',\n 'maxlength': 'maxLength',\n 'nonce': 'nonce',\n 'role': 'role',\n 'rowspan': 'rowSpan',\n 'type': 'type',\n 'usemap': 'useMap',\n 'valign': 'vAlign',\n 'width': 'width'\n};\n\n\n/**\n * Gets the dimensions of the viewport.\n *\n * Gecko Standards mode:\n * docEl.clientWidth Width of viewport excluding scrollbar.\n * win.innerWidth Width of viewport including scrollbar.\n * body.clientWidth Width of body element.\n *\n * docEl.clientHeight Height of viewport excluding scrollbar.\n * win.innerHeight Height of viewport including scrollbar.\n * body.clientHeight Height of document.\n *\n * Gecko Backwards compatible mode:\n * docEl.clientWidth Width of viewport excluding scrollbar.\n * win.innerWidth Width of viewport including scrollbar.\n * body.clientWidth Width of viewport excluding scrollbar.\n *\n * docEl.clientHeight Height of document.\n * win.innerHeight Height of viewport including scrollbar.\n * body.clientHeight Height of viewport excluding scrollbar.\n *\n * IE6/7 Standards mode:\n * docEl.clientWidth Width of viewport excluding scrollbar.\n * win.innerWidth Undefined.\n * body.clientWidth Width of body element.\n *\n * docEl.clientHeight Height of viewport excluding scrollbar.\n * win.innerHeight Undefined.\n * body.clientHeight Height of document element.\n *\n * IE5 + IE6/7 Backwards compatible mode:\n * docEl.clientWidth 0.\n * win.innerWidth Undefined.\n * body.clientWidth Width of viewport excluding scrollbar.\n *\n * docEl.clientHeight 0.\n * win.innerHeight Undefined.\n * body.clientHeight Height of viewport excluding scrollbar.\n *\n * Opera 9 Standards and backwards compatible mode:\n * docEl.clientWidth Width of viewport excluding scrollbar.\n * win.innerWidth Width of viewport including scrollbar.\n * body.clientWidth Width of viewport excluding scrollbar.\n *\n * docEl.clientHeight Height of document.\n * win.innerHeight Height of viewport including scrollbar.\n * body.clientHeight Height of viewport excluding scrollbar.\n *\n * WebKit:\n * Safari 2\n * docEl.clientHeight Same as scrollHeight.\n * docEl.clientWidth Same as innerWidth.\n * win.innerWidth Width of viewport excluding scrollbar.\n * win.innerHeight Height of the viewport including scrollbar.\n * frame.innerHeight Height of the viewport exluding scrollbar.\n *\n * Safari 3 (tested in 522)\n *\n * docEl.clientWidth Width of viewport excluding scrollbar.\n * docEl.clientHeight Height of viewport excluding scrollbar in strict mode.\n * body.clientHeight Height of viewport excluding scrollbar in quirks mode.\n *\n * @param {Window=} opt_window Optional window element to test.\n * @return {!goog.math.Size} Object with values 'width' and 'height'.\n */\ngoog.dom.getViewportSize = function(opt_window) {\n 'use strict';\n // TODO(arv): This should not take an argument\n return goog.dom.getViewportSize_(opt_window || window);\n};\n\n\n/**\n * Helper for `getViewportSize`.\n * @param {Window} win The window to get the view port size for.\n * @return {!goog.math.Size} Object with values 'width' and 'height'.\n * @private\n */\ngoog.dom.getViewportSize_ = function(win) {\n 'use strict';\n var doc = win.document;\n var el = goog.dom.isCss1CompatMode_(doc) ? doc.documentElement : doc.body;\n return new goog.math.Size(el.clientWidth, el.clientHeight);\n};\n\n\n/**\n * Calculates the height of the document.\n *\n * @return {number} The height of the current document.\n */\ngoog.dom.getDocumentHeight = function() {\n 'use strict';\n return goog.dom.getDocumentHeight_(window);\n};\n\n/**\n * Calculates the height of the document of the given window.\n *\n * @param {!Window} win The window whose document height to retrieve.\n * @return {number} The height of the document of the given window.\n */\ngoog.dom.getDocumentHeightForWindow = function(win) {\n 'use strict';\n return goog.dom.getDocumentHeight_(win);\n};\n\n/**\n * Calculates the height of the document of the given window.\n *\n * Function code copied from the opensocial gadget api:\n * gadgets.window.adjustHeight(opt_height)\n *\n * @private\n * @param {!Window} win The window whose document height to retrieve.\n * @return {number} The height of the document of the given window.\n */\ngoog.dom.getDocumentHeight_ = function(win) {\n 'use strict';\n // NOTE(eae): This method will return the window size rather than the document\n // size in webkit quirks mode.\n var doc = win.document;\n var height = 0;\n\n if (doc) {\n // Calculating inner content height is hard and different between\n // browsers rendering in Strict vs. Quirks mode. We use a combination of\n // three properties within document.body and document.documentElement:\n // - scrollHeight\n // - offsetHeight\n // - clientHeight\n // These values differ significantly between browsers and rendering modes.\n // But there are patterns. It just takes a lot of time and persistence\n // to figure out.\n\n var body = doc.body;\n var docEl = /** @type {!HTMLElement} */ (doc.documentElement);\n if (!(docEl && body)) {\n return 0;\n }\n\n // Get the height of the viewport\n var vh = goog.dom.getViewportSize_(win).height;\n if (goog.dom.isCss1CompatMode_(doc) && docEl.scrollHeight) {\n // In Strict mode:\n // The inner content height is contained in either:\n // document.documentElement.scrollHeight\n // document.documentElement.offsetHeight\n // Based on studying the values output by different browsers,\n // use the value that's NOT equal to the viewport height found above.\n height =\n docEl.scrollHeight != vh ? docEl.scrollHeight : docEl.offsetHeight;\n } else {\n // In Quirks mode:\n // documentElement.clientHeight is equal to documentElement.offsetHeight\n // except in IE. In most browsers, document.documentElement can be used\n // to calculate the inner content height.\n // However, in other browsers (e.g. IE), document.body must be used\n // instead. How do we know which one to use?\n // If document.documentElement.clientHeight does NOT equal\n // document.documentElement.offsetHeight, then use document.body.\n var sh = docEl.scrollHeight;\n var oh = docEl.offsetHeight;\n if (docEl.clientHeight != oh) {\n sh = body.scrollHeight;\n oh = body.offsetHeight;\n }\n\n // Detect whether the inner content height is bigger or smaller\n // than the bounding box (viewport). If bigger, take the larger\n // value. If smaller, take the smaller value.\n if (sh > vh) {\n // Content is larger\n height = sh > oh ? sh : oh;\n } else {\n // Content is smaller\n height = sh < oh ? sh : oh;\n }\n }\n }\n\n return height;\n};\n\n\n/**\n * Gets the page scroll distance as a coordinate object.\n *\n * @param {Window=} opt_window Optional window element to test.\n * @return {!goog.math.Coordinate} Object with values 'x' and 'y'.\n * @deprecated Use {@link goog.dom.getDocumentScroll} instead.\n */\ngoog.dom.getPageScroll = function(opt_window) {\n 'use strict';\n var win = opt_window || goog.global || window;\n return goog.dom.getDomHelper(win.document).getDocumentScroll();\n};\n\n\n/**\n * Gets the document scroll distance as a coordinate object.\n *\n * @return {!goog.math.Coordinate} Object with values 'x' and 'y'.\n */\ngoog.dom.getDocumentScroll = function() {\n 'use strict';\n return goog.dom.getDocumentScroll_(document);\n};\n\n\n/**\n * Helper for `getDocumentScroll`.\n *\n * @param {!Document} doc The document to get the scroll for.\n * @return {!goog.math.Coordinate} Object with values 'x' and 'y'.\n * @private\n */\ngoog.dom.getDocumentScroll_ = function(doc) {\n 'use strict';\n var el = goog.dom.getDocumentScrollElement_(doc);\n var win = goog.dom.getWindow_(doc);\n if (goog.userAgent.IE && win.pageYOffset != el.scrollTop) {\n // The keyboard on IE10 touch devices shifts the page using the pageYOffset\n // without modifying scrollTop. For this case, we want the body scroll\n // offsets.\n return new goog.math.Coordinate(el.scrollLeft, el.scrollTop);\n }\n return new goog.math.Coordinate(\n win.pageXOffset || el.scrollLeft, win.pageYOffset || el.scrollTop);\n};\n\n\n/**\n * Gets the document scroll element.\n * @return {!Element} Scrolling element.\n */\ngoog.dom.getDocumentScrollElement = function() {\n 'use strict';\n return goog.dom.getDocumentScrollElement_(document);\n};\n\n\n/**\n * Helper for `getDocumentScrollElement`.\n * @param {!Document} doc The document to get the scroll element for.\n * @return {!Element} Scrolling element.\n * @private\n */\ngoog.dom.getDocumentScrollElement_ = function(doc) {\n 'use strict';\n // Old WebKit needs body.scrollLeft in both quirks mode and strict mode. We\n // also default to the documentElement if the document does not have a body\n // (e.g. a SVG document).\n // Uses http://dev.w3.org/csswg/cssom-view/#dom-document-scrollingelement to\n // avoid trying to guess about browser behavior from the UA string.\n if (doc.scrollingElement) {\n return doc.scrollingElement;\n }\n if (!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(doc)) {\n return doc.documentElement;\n }\n return doc.body || doc.documentElement;\n};\n\n\n/**\n * Gets the window object associated with the given document.\n *\n * @param {Document=} opt_doc Document object to get window for.\n * @return {!Window} The window associated with the given document.\n */\ngoog.dom.getWindow = function(opt_doc) {\n 'use strict';\n // TODO(arv): This should not take an argument.\n return opt_doc ? goog.dom.getWindow_(opt_doc) : window;\n};\n\n\n/**\n * Helper for `getWindow`.\n *\n * @param {!Document} doc Document object to get window for.\n * @return {!Window} The window associated with the given document.\n * @private\n */\ngoog.dom.getWindow_ = function(doc) {\n 'use strict';\n return /** @type {!Window} */ (doc.parentWindow || doc.defaultView);\n};\n\n\n/**\n * Returns a dom node with a set of attributes. This function accepts varargs\n * for subsequent nodes to be added. Subsequent nodes will be added to the\n * first node as childNodes.\n *\n * So:\n * <code>createDom(goog.dom.TagName.DIV, null, createDom(goog.dom.TagName.P),\n * createDom(goog.dom.TagName.P));</code> would return a div with two child\n * paragraphs\n *\n * This function uses {@link goog.dom.setProperties} to set attributes: the\n * `opt_attributes` parameter follows the same rules.\n *\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\n * of name-value pairs for attributes. If a string, then this is the\n * className of the new element. If an array, the elements will be joined\n * together as the className of the new element.\n * @param {...(Object|string|Array|NodeList|null|undefined)} var_args Further\n * DOM nodes or strings for text nodes. If one of the var_args is an array\n * or NodeList, its elements will be added as childNodes instead.\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\n * is a string or a more specific type if it is a member of\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.createDom = function(tagName, opt_attributes, var_args) {\n 'use strict';\n return goog.dom.createDom_(document, arguments);\n};\n\n\n/**\n * Helper for `createDom`.\n * @param {!Document} doc The document to create the DOM in.\n * @param {!Arguments} args Argument object passed from the callers. See\n * `goog.dom.createDom` for details.\n * @return {!Element} Reference to a DOM node.\n * @private\n */\ngoog.dom.createDom_ = function(doc, args) {\n 'use strict';\n var tagName = String(args[0]);\n var attributes = args[1];\n\n var element = goog.dom.createElement_(doc, tagName);\n\n if (attributes) {\n if (typeof attributes === 'string') {\n element.className = attributes;\n } else if (Array.isArray(attributes)) {\n element.className = attributes.join(' ');\n } else {\n goog.dom.setProperties(element, attributes);\n }\n }\n\n if (args.length > 2) {\n goog.dom.append_(doc, element, args, 2);\n }\n\n return element;\n};\n\n\n/**\n * Appends a node with text or other nodes.\n * @param {!Document} doc The document to create new nodes in.\n * @param {!Node} parent The node to append nodes to.\n * @param {!Arguments} args The values to add. See `goog.dom.append`.\n * @param {number} startIndex The index of the array to start from.\n * @private\n */\ngoog.dom.append_ = function(doc, parent, args, startIndex) {\n 'use strict';\n function childHandler(child) {\n // TODO(user): More coercion, ala MochiKit?\n if (child) {\n parent.appendChild(\n typeof child === 'string' ? doc.createTextNode(child) : child);\n }\n }\n\n for (var i = startIndex; i < args.length; i++) {\n var arg = args[i];\n // TODO(attila): Fix isArrayLike to return false for a text node.\n if (goog.isArrayLike(arg) && !goog.dom.isNodeLike(arg)) {\n // If the argument is a node list, not a real array, use a clone,\n // because forEach can't be used to mutate a NodeList.\n goog.array.forEach(\n goog.dom.isNodeList(arg) ? goog.array.toArray(arg) : arg,\n childHandler);\n } else {\n childHandler(arg);\n }\n }\n};\n\n\n/**\n * Alias for `createDom`.\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\n * of name-value pairs for attributes. If a string, then this is the\n * className of the new element. If an array, the elements will be joined\n * together as the className of the new element.\n * @param {...(Object|string|Array|NodeList|null|undefined)} var_args Further\n * DOM nodes or strings for text nodes. If one of the var_args is an array,\n * its children will be added as childNodes instead.\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\n * is a string or a more specific type if it is a member of\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n * @deprecated Use {@link goog.dom.createDom} instead.\n */\ngoog.dom.$dom = goog.dom.createDom;\n\n\n/**\n * Creates a new element.\n * @param {string|!goog.dom.TagName<T>} name Tag to create.\n * @return {R} The new element. The return type is {!Element} if name is\n * a string or a more specific type if it is a member of goog.dom.TagName\n * (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.createElement = function(name) {\n 'use strict';\n return goog.dom.createElement_(document, name);\n};\n\n\n/**\n * Creates a new element.\n * @param {!Document} doc The document to create the element in.\n * @param {string|!goog.dom.TagName<T>} name Tag to create.\n * @return {R} The new element. The return type is {!Element} if name is\n * a string or a more specific type if it is a member of goog.dom.TagName\n * (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n * @private\n */\ngoog.dom.createElement_ = function(doc, name) {\n 'use strict';\n name = String(name);\n if (doc.contentType === 'application/xhtml+xml') name = name.toLowerCase();\n return doc.createElement(name);\n};\n\n\n/**\n * Creates a new text node.\n * @param {number|string} content Content.\n * @return {!Text} The new text node.\n */\ngoog.dom.createTextNode = function(content) {\n 'use strict';\n return document.createTextNode(String(content));\n};\n\n\n/**\n * Create a table.\n * @param {number} rows The number of rows in the table. Must be >= 1.\n * @param {number} columns The number of columns in the table. Must be >= 1.\n * @param {boolean=} opt_fillWithNbsp If true, fills table entries with\n * `goog.string.Unicode.NBSP` characters.\n * @return {!Element} The created table.\n */\ngoog.dom.createTable = function(rows, columns, opt_fillWithNbsp) {\n 'use strict';\n // TODO(mlourenco): Return HTMLTableElement, also in prototype function.\n // Callers need to be updated to e.g. not assign numbers to table.cellSpacing.\n return goog.dom.createTable_(document, rows, columns, !!opt_fillWithNbsp);\n};\n\n\n/**\n * Create a table.\n * @param {!Document} doc Document object to use to create the table.\n * @param {number} rows The number of rows in the table. Must be >= 1.\n * @param {number} columns The number of columns in the table. Must be >= 1.\n * @param {boolean} fillWithNbsp If true, fills table entries with\n * `goog.string.Unicode.NBSP` characters.\n * @return {!HTMLTableElement} The created table.\n * @private\n */\ngoog.dom.createTable_ = function(doc, rows, columns, fillWithNbsp) {\n 'use strict';\n var table = goog.dom.createElement_(doc, goog.dom.TagName.TABLE);\n var tbody =\n table.appendChild(goog.dom.createElement_(doc, goog.dom.TagName.TBODY));\n for (var i = 0; i < rows; i++) {\n var tr = goog.dom.createElement_(doc, goog.dom.TagName.TR);\n for (var j = 0; j < columns; j++) {\n var td = goog.dom.createElement_(doc, goog.dom.TagName.TD);\n // IE <= 9 will create a text node if we set text content to the empty\n // string, so we avoid doing it unless necessary. This ensures that the\n // same DOM tree is returned on all browsers.\n if (fillWithNbsp) {\n goog.dom.setTextContent(td, goog.string.Unicode.NBSP);\n }\n tr.appendChild(td);\n }\n tbody.appendChild(tr);\n }\n return table;\n};\n\n\n\n/**\n * Creates a new Node from constant strings of HTML markup.\n * @param {...!goog.string.Const} var_args The HTML strings to concatenate then\n * convert into a node.\n * @return {!Node}\n */\ngoog.dom.constHtmlToNode = function(var_args) {\n 'use strict';\n var stringArray =\n Array.prototype.map.call(arguments, goog.string.Const.unwrap);\n var safeHtml =\n goog.html.uncheckedconversions\n .safeHtmlFromStringKnownToSatisfyTypeContract(\n goog.string.Const.from(\n 'Constant HTML string, that gets turned into a ' +\n 'Node later, so it will be automatically balanced.'),\n stringArray.join(''));\n return goog.dom.safeHtmlToNode(safeHtml);\n};\n\n\n/**\n * Converts HTML markup into a node. This is a safe version of\n * `goog.dom.htmlToDocumentFragment` which is now deleted.\n * @param {!goog.html.SafeHtml} html The HTML markup to convert.\n * @return {!Node} The resulting node.\n */\ngoog.dom.safeHtmlToNode = function(html) {\n 'use strict';\n return goog.dom.safeHtmlToNode_(document, html);\n};\n\n\n/**\n * Helper for `safeHtmlToNode`.\n * @param {!Document} doc The document.\n * @param {!goog.html.SafeHtml} html The HTML markup to convert.\n * @return {!Node} The resulting node.\n * @private\n */\ngoog.dom.safeHtmlToNode_ = function(doc, html) {\n 'use strict';\n var tempDiv = goog.dom.createElement_(doc, goog.dom.TagName.DIV);\n if (goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT) {\n goog.dom.safe.setInnerHtml(\n tempDiv, goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, html));\n tempDiv.removeChild(goog.asserts.assert(tempDiv.firstChild));\n } else {\n goog.dom.safe.setInnerHtml(tempDiv, html);\n }\n return goog.dom.childrenToNode_(doc, tempDiv);\n};\n\n\n/**\n * Helper for `safeHtmlToNode_`.\n * @param {!Document} doc The document.\n * @param {!Node} tempDiv The input node.\n * @return {!Node} The resulting node.\n * @private\n */\ngoog.dom.childrenToNode_ = function(doc, tempDiv) {\n 'use strict';\n if (tempDiv.childNodes.length == 1) {\n return tempDiv.removeChild(goog.asserts.assert(tempDiv.firstChild));\n } else {\n var fragment = doc.createDocumentFragment();\n while (tempDiv.firstChild) {\n fragment.appendChild(tempDiv.firstChild);\n }\n return fragment;\n }\n};\n\n\n/**\n * Returns true if the browser is in \"CSS1-compatible\" (standards-compliant)\n * mode, false otherwise.\n * @return {boolean} True if in CSS1-compatible mode.\n */\ngoog.dom.isCss1CompatMode = function() {\n 'use strict';\n return goog.dom.isCss1CompatMode_(document);\n};\n\n\n/**\n * Returns true if the browser is in \"CSS1-compatible\" (standards-compliant)\n * mode, false otherwise.\n * @param {!Document} doc The document to check.\n * @return {boolean} True if in CSS1-compatible mode.\n * @private\n */\ngoog.dom.isCss1CompatMode_ = function(doc) {\n 'use strict';\n if (goog.dom.COMPAT_MODE_KNOWN_) {\n return goog.dom.ASSUME_STANDARDS_MODE;\n }\n\n return doc.compatMode == 'CSS1Compat';\n};\n\n\n/**\n * Determines if the given node can contain children, intended to be used for\n * HTML generation.\n *\n * IE natively supports node.canHaveChildren but has inconsistent behavior.\n * Prior to IE8 the base tag allows children and in IE9 all nodes return true\n * for canHaveChildren.\n *\n * In practice all non-IE browsers allow you to add children to any node, but\n * the behavior is inconsistent:\n *\n * <pre>\n * var a = goog.dom.createElement(goog.dom.TagName.BR);\n * a.appendChild(document.createTextNode('foo'));\n * a.appendChild(document.createTextNode('bar'));\n * console.log(a.childNodes.length); // 2\n * console.log(a.innerHTML); // Chrome: \"\", IE9: \"foobar\", FF3.5: \"foobar\"\n * </pre>\n *\n * For more information, see:\n * http://dev.w3.org/html5/markup/syntax.html#syntax-elements\n *\n * TODO(user): Rename shouldAllowChildren() ?\n *\n * @param {Node} node The node to check.\n * @return {boolean} Whether the node can contain children.\n */\ngoog.dom.canHaveChildren = function(node) {\n 'use strict';\n if (node.nodeType != goog.dom.NodeType.ELEMENT) {\n return false;\n }\n switch (/** @type {!Element} */ (node).tagName) {\n case String(goog.dom.TagName.APPLET):\n case String(goog.dom.TagName.AREA):\n case String(goog.dom.TagName.BASE):\n case String(goog.dom.TagName.BR):\n case String(goog.dom.TagName.COL):\n case String(goog.dom.TagName.COMMAND):\n case String(goog.dom.TagName.EMBED):\n case String(goog.dom.TagName.FRAME):\n case String(goog.dom.TagName.HR):\n case String(goog.dom.TagName.IMG):\n case String(goog.dom.TagName.INPUT):\n case String(goog.dom.TagName.IFRAME):\n case String(goog.dom.TagName.ISINDEX):\n case String(goog.dom.TagName.KEYGEN):\n case String(goog.dom.TagName.LINK):\n case String(goog.dom.TagName.NOFRAMES):\n case String(goog.dom.TagName.NOSCRIPT):\n case String(goog.dom.TagName.META):\n case String(goog.dom.TagName.OBJECT):\n case String(goog.dom.TagName.PARAM):\n case String(goog.dom.TagName.SCRIPT):\n case String(goog.dom.TagName.SOURCE):\n case String(goog.dom.TagName.STYLE):\n case String(goog.dom.TagName.TRACK):\n case String(goog.dom.TagName.WBR):\n return false;\n }\n return true;\n};\n\n\n/**\n * Appends a child to a node.\n * @param {Node} parent Parent.\n * @param {Node} child Child.\n */\ngoog.dom.appendChild = function(parent, child) {\n 'use strict';\n goog.asserts.assert(\n parent != null && child != null,\n 'goog.dom.appendChild expects non-null arguments');\n parent.appendChild(child);\n};\n\n\n/**\n * Appends a node with text or other nodes.\n * @param {!Node} parent The node to append nodes to.\n * @param {...goog.dom.Appendable} var_args The things to append to the node.\n * If this is a Node it is appended as is.\n * If this is a string then a text node is appended.\n * If this is an array like object then fields 0 to length - 1 are appended.\n */\ngoog.dom.append = function(parent, var_args) {\n 'use strict';\n goog.dom.append_(goog.dom.getOwnerDocument(parent), parent, arguments, 1);\n};\n\n\n/**\n * Removes all the child nodes on a DOM node.\n * @param {Node} node Node to remove children from.\n * @return {void}\n */\ngoog.dom.removeChildren = function(node) {\n 'use strict';\n // Note: Iterations over live collections can be slow, this is the fastest\n // we could find. The double parenthesis are used to prevent JsCompiler and\n // strict warnings.\n var child;\n while ((child = node.firstChild)) {\n node.removeChild(child);\n }\n};\n\n\n/**\n * Inserts a new node before an existing reference node (i.e. as the previous\n * sibling). If the reference node has no parent, then does nothing.\n * @param {Node} newNode Node to insert.\n * @param {Node} refNode Reference node to insert before.\n */\ngoog.dom.insertSiblingBefore = function(newNode, refNode) {\n 'use strict';\n goog.asserts.assert(\n newNode != null && refNode != null,\n 'goog.dom.insertSiblingBefore expects non-null arguments');\n if (refNode.parentNode) {\n refNode.parentNode.insertBefore(newNode, refNode);\n }\n};\n\n\n/**\n * Inserts a new node after an existing reference node (i.e. as the next\n * sibling). If the reference node has no parent, then does nothing.\n * @param {Node} newNode Node to insert.\n * @param {Node} refNode Reference node to insert after.\n * @return {void}\n */\ngoog.dom.insertSiblingAfter = function(newNode, refNode) {\n 'use strict';\n goog.asserts.assert(\n newNode != null && refNode != null,\n 'goog.dom.insertSiblingAfter expects non-null arguments');\n if (refNode.parentNode) {\n refNode.parentNode.insertBefore(newNode, refNode.nextSibling);\n }\n};\n\n\n/**\n * Insert a child at a given index. If index is larger than the number of child\n * nodes that the parent currently has, the node is inserted as the last child\n * node.\n * @param {Element} parent The element into which to insert the child.\n * @param {Node} child The element to insert.\n * @param {number} index The index at which to insert the new child node. Must\n * not be negative.\n * @return {void}\n */\ngoog.dom.insertChildAt = function(parent, child, index) {\n 'use strict';\n // Note that if the second argument is null, insertBefore\n // will append the child at the end of the list of children.\n goog.asserts.assert(\n parent != null, 'goog.dom.insertChildAt expects a non-null parent');\n parent.insertBefore(\n /** @type {!Node} */ (child), parent.childNodes[index] || null);\n};\n\n\n/**\n * Removes a node from its parent.\n * @param {Node} node The node to remove.\n * @return {Node} The node removed if removed; else, null.\n */\ngoog.dom.removeNode = function(node) {\n 'use strict';\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\n};\n\n\n/**\n * Replaces a node in the DOM tree. Will do nothing if `oldNode` has no\n * parent.\n * @param {Node} newNode Node to insert.\n * @param {Node} oldNode Node to replace.\n */\ngoog.dom.replaceNode = function(newNode, oldNode) {\n 'use strict';\n goog.asserts.assert(\n newNode != null && oldNode != null,\n 'goog.dom.replaceNode expects non-null arguments');\n var parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n};\n\n\n/**\n * Replaces child nodes of `target` with child nodes of `source`. This is\n * roughly equivalent to `target.innerHTML = source.innerHTML` which is not\n * compatible with Trusted Types.\n * @param {?Node} target Node to clean and replace its children.\n * @param {?Node} source Node to get the children from. The nodes will be cloned\n * so they will stay in source.\n */\ngoog.dom.copyContents = function(target, source) {\n 'use strict';\n goog.asserts.assert(\n target != null && source != null,\n 'goog.dom.copyContents expects non-null arguments');\n var childNodes = source.cloneNode(/* deep= */ true).childNodes;\n goog.dom.removeChildren(target);\n while (childNodes.length) {\n target.appendChild(childNodes[0]);\n }\n};\n\n\n/**\n * Flattens an element. That is, removes it and replace it with its children.\n * Does nothing if the element is not in the document.\n * @param {Element} element The element to flatten.\n * @return {Element|undefined} The original element, detached from the document\n * tree, sans children; or undefined, if the element was not in the document\n * to begin with.\n */\ngoog.dom.flattenElement = function(element) {\n 'use strict';\n var child, parent = element.parentNode;\n if (parent && parent.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) {\n // Use IE DOM method (supported by Opera too) if available\n if (element.removeNode) {\n return /** @type {Element} */ (element.removeNode(false));\n } else {\n // Move all children of the original node up one level.\n while ((child = element.firstChild)) {\n parent.insertBefore(child, element);\n }\n\n // Detach the original element.\n return /** @type {Element} */ (goog.dom.removeNode(element));\n }\n }\n};\n\n\n/**\n * Returns an array containing just the element children of the given element.\n * @param {Element} element The element whose element children we want.\n * @return {!(Array<!Element>|NodeList<!Element>)} An array or array-like list\n * of just the element children of the given element.\n */\ngoog.dom.getChildren = function(element) {\n 'use strict';\n // We check if the children attribute is supported for child elements\n // since IE8 misuses the attribute by also including comments.\n if (element.children != undefined) {\n return element.children;\n }\n // Fall back to manually filtering the element's child nodes.\n return Array.prototype.filter.call(element.childNodes, function(node) {\n return node.nodeType == goog.dom.NodeType.ELEMENT;\n });\n};\n\n\n/**\n * Returns the first child node that is an element.\n * @param {Node} node The node to get the first child element of.\n * @return {Element} The first child node of `node` that is an element.\n */\ngoog.dom.getFirstElementChild = function(node) {\n 'use strict';\n if (node.firstElementChild !== undefined) {\n return /** @type {!Element} */ (node).firstElementChild;\n }\n return goog.dom.getNextElementNode_(node.firstChild, true);\n};\n\n\n/**\n * Returns the last child node that is an element.\n * @param {Node} node The node to get the last child element of.\n * @return {Element} The last child node of `node` that is an element.\n */\ngoog.dom.getLastElementChild = function(node) {\n 'use strict';\n if (node.lastElementChild !== undefined) {\n return /** @type {!Element} */ (node).lastElementChild;\n }\n return goog.dom.getNextElementNode_(node.lastChild, false);\n};\n\n\n/**\n * Returns the first next sibling that is an element.\n * @param {Node} node The node to get the next sibling element of.\n * @return {Element} The next sibling of `node` that is an element.\n */\ngoog.dom.getNextElementSibling = function(node) {\n 'use strict';\n if (node.nextElementSibling !== undefined) {\n return /** @type {!Element} */ (node).nextElementSibling;\n }\n return goog.dom.getNextElementNode_(node.nextSibling, true);\n};\n\n\n/**\n * Returns the first previous sibling that is an element.\n * @param {Node} node The node to get the previous sibling element of.\n * @return {Element} The first previous sibling of `node` that is\n * an element.\n */\ngoog.dom.getPreviousElementSibling = function(node) {\n 'use strict';\n if (node.previousElementSibling !== undefined) {\n return /** @type {!Element} */ (node).previousElementSibling;\n }\n return goog.dom.getNextElementNode_(node.previousSibling, false);\n};\n\n\n/**\n * Returns the first node that is an element in the specified direction,\n * starting with `node`.\n * @param {Node} node The node to get the next element from.\n * @param {boolean} forward Whether to look forwards or backwards.\n * @return {Element} The first element.\n * @private\n */\ngoog.dom.getNextElementNode_ = function(node, forward) {\n 'use strict';\n while (node && node.nodeType != goog.dom.NodeType.ELEMENT) {\n node = forward ? node.nextSibling : node.previousSibling;\n }\n\n return /** @type {Element} */ (node);\n};\n\n\n/**\n * Returns the next node in source order from the given node.\n * @param {Node} node The node.\n * @return {Node} The next node in the DOM tree, or null if this was the last\n * node.\n */\ngoog.dom.getNextNode = function(node) {\n 'use strict';\n if (!node) {\n return null;\n }\n\n if (node.firstChild) {\n return node.firstChild;\n }\n\n while (node && !node.nextSibling) {\n node = node.parentNode;\n }\n\n return node ? node.nextSibling : null;\n};\n\n\n/**\n * Returns the previous node in source order from the given node.\n * @param {Node} node The node.\n * @return {Node} The previous node in the DOM tree, or null if this was the\n * first node.\n */\ngoog.dom.getPreviousNode = function(node) {\n 'use strict';\n if (!node) {\n return null;\n }\n\n if (!node.previousSibling) {\n return node.parentNode;\n }\n\n node = node.previousSibling;\n while (node && node.lastChild) {\n node = node.lastChild;\n }\n\n return node;\n};\n\n\n/**\n * Whether the object looks like a DOM node.\n * @param {?} obj The object being tested for node likeness.\n * @return {boolean} Whether the object looks like a DOM node.\n */\ngoog.dom.isNodeLike = function(obj) {\n 'use strict';\n return goog.isObject(obj) && obj.nodeType > 0;\n};\n\n\n/**\n * Whether the object looks like an Element.\n * @param {?} obj The object being tested for Element likeness.\n * @return {boolean} Whether the object looks like an Element.\n */\ngoog.dom.isElement = function(obj) {\n 'use strict';\n return goog.isObject(obj) && obj.nodeType == goog.dom.NodeType.ELEMENT;\n};\n\n\n/**\n * Returns true if the specified value is a Window object. This includes the\n * global window for HTML pages, and iframe windows.\n * @param {?} obj Variable to test.\n * @return {boolean} Whether the variable is a window.\n */\ngoog.dom.isWindow = function(obj) {\n 'use strict';\n return goog.isObject(obj) && obj['window'] == obj;\n};\n\n\n/**\n * Returns an element's parent, if it's an Element.\n * @param {Element} element The DOM element.\n * @return {Element} The parent, or null if not an Element.\n */\ngoog.dom.getParentElement = function(element) {\n 'use strict';\n var parent;\n if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY) {\n parent = element.parentElement;\n if (parent) {\n return parent;\n }\n }\n parent = element.parentNode;\n return goog.dom.isElement(parent) ? /** @type {!Element} */ (parent) : null;\n};\n\n\n/**\n * Whether a node contains another node.\n * @param {?Node|undefined} parent The node that should contain the other node.\n * @param {?Node|undefined} descendant The node to test presence of.\n * @return {boolean} Whether the parent node contains the descendant node.\n */\ngoog.dom.contains = function(parent, descendant) {\n 'use strict';\n if (!parent || !descendant) {\n return false;\n }\n // We use browser specific methods for this if available since it is faster\n // that way.\n\n // IE DOM\n if (parent.contains && descendant.nodeType == goog.dom.NodeType.ELEMENT) {\n return parent == descendant || parent.contains(descendant);\n }\n\n // W3C DOM Level 3\n if (typeof parent.compareDocumentPosition != 'undefined') {\n return parent == descendant ||\n Boolean(parent.compareDocumentPosition(descendant) & 16);\n }\n\n // W3C DOM Level 1\n while (descendant && parent != descendant) {\n descendant = descendant.parentNode;\n }\n return descendant == parent;\n};\n\n\n/**\n * Compares the document order of two nodes, returning 0 if they are the same\n * node, a negative number if node1 is before node2, and a positive number if\n * node2 is before node1. Note that we compare the order the tags appear in the\n * document so in the tree <b><i>text</i></b> the B node is considered to be\n * before the I node.\n *\n * @param {Node} node1 The first node to compare.\n * @param {Node} node2 The second node to compare.\n * @return {number} 0 if the nodes are the same node, a negative number if node1\n * is before node2, and a positive number if node2 is before node1.\n */\ngoog.dom.compareNodeOrder = function(node1, node2) {\n 'use strict';\n // Fall out quickly for equality.\n if (node1 == node2) {\n return 0;\n }\n\n // Use compareDocumentPosition where available\n if (node1.compareDocumentPosition) {\n // 4 is the bitmask for FOLLOWS.\n return node1.compareDocumentPosition(node2) & 2 ? 1 : -1;\n }\n\n // Special case for document nodes on IE 7 and 8.\n if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {\n if (node1.nodeType == goog.dom.NodeType.DOCUMENT) {\n return -1;\n }\n if (node2.nodeType == goog.dom.NodeType.DOCUMENT) {\n return 1;\n }\n }\n\n // Process in IE using sourceIndex - we check to see if the first node has\n // a source index or if its parent has one.\n if ('sourceIndex' in node1 ||\n (node1.parentNode && 'sourceIndex' in node1.parentNode)) {\n var isElement1 = node1.nodeType == goog.dom.NodeType.ELEMENT;\n var isElement2 = node2.nodeType == goog.dom.NodeType.ELEMENT;\n\n if (isElement1 && isElement2) {\n return node1.sourceIndex - node2.sourceIndex;\n } else {\n var parent1 = node1.parentNode;\n var parent2 = node2.parentNode;\n\n if (parent1 == parent2) {\n return goog.dom.compareSiblingOrder_(node1, node2);\n }\n\n if (!isElement1 && goog.dom.contains(parent1, node2)) {\n return -1 * goog.dom.compareParentsDescendantNodeIe_(node1, node2);\n }\n\n\n if (!isElement2 && goog.dom.contains(parent2, node1)) {\n return goog.dom.compareParentsDescendantNodeIe_(node2, node1);\n }\n\n return (isElement1 ? node1.sourceIndex : parent1.sourceIndex) -\n (isElement2 ? node2.sourceIndex : parent2.sourceIndex);\n }\n }\n\n // For Safari, we compare ranges.\n var doc = goog.dom.getOwnerDocument(node1);\n\n var range1, range2;\n range1 = doc.createRange();\n range1.selectNode(node1);\n range1.collapse(true);\n\n range2 = doc.createRange();\n range2.selectNode(node2);\n range2.collapse(true);\n\n return range1.compareBoundaryPoints(\n goog.global['Range'].START_TO_END, range2);\n};\n\n\n/**\n * Utility function to compare the position of two nodes, when\n * `textNode`'s parent is an ancestor of `node`. If this entry\n * condition is not met, this function will attempt to reference a null object.\n * @param {!Node} textNode The textNode to compare.\n * @param {Node} node The node to compare.\n * @return {number} -1 if node is before textNode, +1 otherwise.\n * @private\n */\ngoog.dom.compareParentsDescendantNodeIe_ = function(textNode, node) {\n 'use strict';\n var parent = textNode.parentNode;\n if (parent == node) {\n // If textNode is a child of node, then node comes first.\n return -1;\n }\n var sibling = node;\n while (sibling.parentNode != parent) {\n sibling = sibling.parentNode;\n }\n return goog.dom.compareSiblingOrder_(sibling, textNode);\n};\n\n\n/**\n * Utility function to compare the position of two nodes known to be non-equal\n * siblings.\n * @param {Node} node1 The first node to compare.\n * @param {!Node} node2 The second node to compare.\n * @return {number} -1 if node1 is before node2, +1 otherwise.\n * @private\n */\ngoog.dom.compareSiblingOrder_ = function(node1, node2) {\n 'use strict';\n var s = node2;\n while ((s = s.previousSibling)) {\n if (s == node1) {\n // We just found node1 before node2.\n return -1;\n }\n }\n\n // Since we didn't find it, node1 must be after node2.\n return 1;\n};\n\n\n/**\n * Find the deepest common ancestor of the given nodes.\n * @param {...Node} var_args The nodes to find a common ancestor of.\n * @return {Node} The common ancestor of the nodes, or null if there is none.\n * null will only be returned if two or more of the nodes are from different\n * documents.\n */\ngoog.dom.findCommonAncestor = function(var_args) {\n 'use strict';\n var i, count = arguments.length;\n if (!count) {\n return null;\n } else if (count == 1) {\n return arguments[0];\n }\n\n var paths = [];\n var minLength = Infinity;\n for (i = 0; i < count; i++) {\n // Compute the list of ancestors.\n var ancestors = [];\n var node = arguments[i];\n while (node) {\n ancestors.unshift(node);\n node = node.parentNode;\n }\n\n // Save the list for comparison.\n paths.push(ancestors);\n minLength = Math.min(minLength, ancestors.length);\n }\n var output = null;\n for (i = 0; i < minLength; i++) {\n var first = paths[0][i];\n for (var j = 1; j < count; j++) {\n if (first != paths[j][i]) {\n return output;\n }\n }\n output = first;\n }\n return output;\n};\n\n\n/**\n * Returns whether node is in a document or detached. Throws an error if node\n * itself is a document. This specifically handles two cases beyond naive use of\n * builtins: (1) it works correctly in IE, and (2) it works for elements from\n * different documents/iframes. If neither of these considerations are relevant\n * then a simple `document.contains(node)` may be used instead.\n * @param {!Node} node\n * @return {boolean}\n */\ngoog.dom.isInDocument = function(node) {\n 'use strict';\n return (node.ownerDocument.compareDocumentPosition(node) & 16) == 16;\n};\n\n\n/**\n * Returns the owner document for a node.\n * @param {Node|Window} node The node to get the document for.\n * @return {!Document} The document owning the node.\n */\ngoog.dom.getOwnerDocument = function(node) {\n 'use strict';\n // TODO(nnaze): Update param signature to be non-nullable.\n goog.asserts.assert(node, 'Node cannot be null or undefined.');\n return /** @type {!Document} */ (\n node.nodeType == goog.dom.NodeType.DOCUMENT ?\n node :\n node.ownerDocument || node.document);\n};\n\n\n/**\n * Cross-browser function for getting the document element of a frame or iframe.\n * @param {Element} frame Frame element.\n * @return {!Document} The frame content document.\n */\ngoog.dom.getFrameContentDocument = function(frame) {\n 'use strict';\n return frame.contentDocument ||\n /** @type {!HTMLFrameElement} */ (frame).contentWindow.document;\n};\n\n\n/**\n * Cross-browser function for getting the window of a frame or iframe.\n * @param {Element} frame Frame element.\n * @return {Window} The window associated with the given frame, or null if none\n * exists.\n */\ngoog.dom.getFrameContentWindow = function(frame) {\n 'use strict';\n try {\n return frame.contentWindow ||\n (frame.contentDocument ? goog.dom.getWindow(frame.contentDocument) :\n null);\n } catch (e) {\n // NOTE(user): In IE8, checking the contentWindow or contentDocument\n // properties will throw a \"Unspecified Error\" exception if the iframe is\n // not inserted in the DOM. If we get this we can be sure that no window\n // exists, so return null.\n }\n return null;\n};\n\n\n/**\n * Sets the text content of a node, with cross-browser support.\n * @param {Node} node The node to change the text content of.\n * @param {string|number} text The value that should replace the node's content.\n * @return {void}\n */\ngoog.dom.setTextContent = function(node, text) {\n 'use strict';\n goog.asserts.assert(\n node != null,\n 'goog.dom.setTextContent expects a non-null value for node');\n\n if ('textContent' in node) {\n node.textContent = text;\n } else if (node.nodeType == goog.dom.NodeType.TEXT) {\n /** @type {!Text} */ (node).data = String(text);\n } else if (\n node.firstChild && node.firstChild.nodeType == goog.dom.NodeType.TEXT) {\n // If the first child is a text node we just change its data and remove the\n // rest of the children.\n while (node.lastChild != node.firstChild) {\n node.removeChild(goog.asserts.assert(node.lastChild));\n }\n /** @type {!Text} */ (node.firstChild).data = String(text);\n } else {\n goog.dom.removeChildren(node);\n var doc = goog.dom.getOwnerDocument(node);\n node.appendChild(doc.createTextNode(String(text)));\n }\n};\n\n\n/**\n * Gets the outerHTML of a node, which is like innerHTML, except that it\n * actually contains the HTML of the node itself.\n * @param {Element} element The element to get the HTML of.\n * @return {string} The outerHTML of the given element.\n */\ngoog.dom.getOuterHtml = function(element) {\n 'use strict';\n goog.asserts.assert(\n element !== null,\n 'goog.dom.getOuterHtml expects a non-null value for element');\n // IE, Opera and WebKit all have outerHTML.\n if ('outerHTML' in element) {\n return element.outerHTML;\n } else {\n var doc = goog.dom.getOwnerDocument(element);\n var div = goog.dom.createElement_(doc, goog.dom.TagName.DIV);\n div.appendChild(element.cloneNode(true));\n return div.innerHTML;\n }\n};\n\n\n/**\n * Finds the first descendant node that matches the filter function, using depth\n * first search. This function offers the most general purpose way of finding a\n * matching element.\n *\n * Prefer using `querySelector` if the matching criteria can be expressed as a\n * CSS selector, or `goog.dom.findElement` if you would filter for `nodeType ==\n * Node.ELEMENT_NODE`.\n *\n * @param {Node} root The root of the tree to search.\n * @param {function(Node) : boolean} p The filter function.\n * @return {Node|undefined} The found node or undefined if none is found.\n */\ngoog.dom.findNode = function(root, p) {\n 'use strict';\n var rv = [];\n var found = goog.dom.findNodes_(root, p, rv, true);\n return found ? rv[0] : undefined;\n};\n\n\n/**\n * Finds all the descendant nodes that match the filter function, using depth\n * first search. This function offers the most general-purpose way\n * of finding a set of matching elements.\n *\n * Prefer using `querySelectorAll` if the matching criteria can be expressed as\n * a CSS selector, or `goog.dom.findElements` if you would filter for\n * `nodeType == Node.ELEMENT_NODE`.\n *\n * @param {Node} root The root of the tree to search.\n * @param {function(Node) : boolean} p The filter function.\n * @return {!Array<!Node>} The found nodes or an empty array if none are found.\n */\ngoog.dom.findNodes = function(root, p) {\n 'use strict';\n var rv = [];\n goog.dom.findNodes_(root, p, rv, false);\n return rv;\n};\n\n\n/**\n * Finds the first or all the descendant nodes that match the filter function,\n * using a depth first search.\n * @param {Node} root The root of the tree to search.\n * @param {function(Node) : boolean} p The filter function.\n * @param {!Array<!Node>} rv The found nodes are added to this array.\n * @param {boolean} findOne If true we exit after the first found node.\n * @return {boolean} Whether the search is complete or not. True in case findOne\n * is true and the node is found. False otherwise.\n * @private\n */\ngoog.dom.findNodes_ = function(root, p, rv, findOne) {\n 'use strict';\n if (root != null) {\n var child = root.firstChild;\n while (child) {\n if (p(child)) {\n rv.push(child);\n if (findOne) {\n return true;\n }\n }\n if (goog.dom.findNodes_(child, p, rv, findOne)) {\n return true;\n }\n child = child.nextSibling;\n }\n }\n return false;\n};\n\n\n/**\n * Finds the first descendant element (excluding `root`) that matches the filter\n * function, using depth first search. Prefer using `querySelector` if the\n * matching criteria can be expressed as a CSS selector.\n *\n * @param {!Element | !Document} root\n * @param {function(!Element): boolean} pred Filter function.\n * @return {?Element} First matching element or null if there is none.\n */\ngoog.dom.findElement = function(root, pred) {\n 'use strict';\n var stack = goog.dom.getChildrenReverse_(root);\n while (stack.length > 0) {\n var next = stack.pop();\n if (pred(next)) return next;\n for (var c = next.lastElementChild; c; c = c.previousElementSibling) {\n stack.push(c);\n }\n }\n return null;\n};\n\n\n/**\n * Finds all the descendant elements (excluding `root`) that match the filter\n * function, using depth first search. Prefer using `querySelectorAll` if the\n * matching criteria can be expressed as a CSS selector.\n *\n * @param {!Element | !Document} root\n * @param {function(!Element): boolean} pred Filter function.\n * @return {!Array<!Element>}\n */\ngoog.dom.findElements = function(root, pred) {\n 'use strict';\n var result = [], stack = goog.dom.getChildrenReverse_(root);\n while (stack.length > 0) {\n var next = stack.pop();\n if (pred(next)) result.push(next);\n for (var c = next.lastElementChild; c; c = c.previousElementSibling) {\n stack.push(c);\n }\n }\n return result;\n};\n\n\n/**\n * @param {!Element | !Document} node\n * @return {!Array<!Element>} node's child elements in reverse order.\n * @private\n */\ngoog.dom.getChildrenReverse_ = function(node) {\n 'use strict';\n // document.lastElementChild doesn't exist in IE9; fall back to\n // documentElement.\n if (node.nodeType == goog.dom.NodeType.DOCUMENT) {\n return [node.documentElement];\n } else {\n var children = [];\n for (var c = node.lastElementChild; c; c = c.previousElementSibling) {\n children.push(c);\n }\n return children;\n }\n};\n\n\n/**\n * Map of tags whose content to ignore when calculating text length.\n * @private {!Object<string, number>}\n * @const\n */\ngoog.dom.TAGS_TO_IGNORE_ = {\n 'SCRIPT': 1,\n 'STYLE': 1,\n 'HEAD': 1,\n 'IFRAME': 1,\n 'OBJECT': 1\n};\n\n\n/**\n * Map of tags which have predefined values with regard to whitespace.\n * @private {!Object<string, string>}\n * @const\n */\ngoog.dom.PREDEFINED_TAG_VALUES_ = {\n 'IMG': ' ',\n 'BR': '\\n'\n};\n\n\n/**\n * Returns true if the element has a tab index that allows it to receive\n * keyboard focus (tabIndex >= 0), false otherwise. Note that some elements\n * natively support keyboard focus, even if they have no tab index.\n * @param {!Element} element Element to check.\n * @return {boolean} Whether the element has a tab index that allows keyboard\n * focus.\n */\ngoog.dom.isFocusableTabIndex = function(element) {\n 'use strict';\n return goog.dom.hasSpecifiedTabIndex_(element) &&\n goog.dom.isTabIndexFocusable_(element);\n};\n\n\n/**\n * Enables or disables keyboard focus support on the element via its tab index.\n * Only elements for which {@link goog.dom.isFocusableTabIndex} returns true\n * (or elements that natively support keyboard focus, like form elements) can\n * receive keyboard focus. See http://go/tabindex for more info.\n * @param {Element} element Element whose tab index is to be changed.\n * @param {boolean} enable Whether to set or remove a tab index on the element\n * that supports keyboard focus.\n * @return {void}\n */\ngoog.dom.setFocusableTabIndex = function(element, enable) {\n 'use strict';\n if (enable) {\n element.tabIndex = 0;\n } else {\n // Set tabIndex to -1 first, then remove it. This is a workaround for\n // Safari (confirmed in version 4 on Windows). When removing the attribute\n // without setting it to -1 first, the element remains keyboard focusable\n // despite not having a tabIndex attribute anymore.\n element.tabIndex = -1;\n element.removeAttribute('tabIndex'); // Must be camelCase!\n }\n};\n\n\n/**\n * Returns true if the element can be focused, i.e. it has a tab index that\n * allows it to receive keyboard focus (tabIndex >= 0), or it is an element\n * that natively supports keyboard focus.\n * @param {!Element} element Element to check.\n * @return {boolean} Whether the element allows keyboard focus.\n */\ngoog.dom.isFocusable = function(element) {\n 'use strict';\n var focusable;\n // Some elements can have unspecified tab index and still receive focus.\n if (goog.dom.nativelySupportsFocus_(element)) {\n // Make sure the element is not disabled ...\n focusable = !element.disabled &&\n // ... and if a tab index is specified, it allows focus.\n (!goog.dom.hasSpecifiedTabIndex_(element) ||\n goog.dom.isTabIndexFocusable_(element));\n } else {\n focusable = goog.dom.isFocusableTabIndex(element);\n }\n\n // IE requires elements to be visible in order to focus them.\n return focusable && goog.userAgent.IE ?\n goog.dom.hasNonZeroBoundingRect_(/** @type {!HTMLElement} */ (element)) :\n focusable;\n};\n\n\n/**\n * Returns true if the element has a specified tab index.\n * @param {!Element} element Element to check.\n * @return {boolean} Whether the element has a specified tab index.\n * @private\n */\ngoog.dom.hasSpecifiedTabIndex_ = function(element) {\n 'use strict';\n return element.hasAttribute('tabindex');\n};\n\n\n/**\n * Returns true if the element's tab index allows the element to be focused.\n * @param {!Element} element Element to check.\n * @return {boolean} Whether the element's tab index allows focus.\n * @private\n */\ngoog.dom.isTabIndexFocusable_ = function(element) {\n 'use strict';\n var index = /** @type {!HTMLElement} */ (element).tabIndex;\n // NOTE: IE9 puts tabIndex in 16-bit int, e.g. -2 is 65534.\n return typeof (index) === 'number' && index >= 0 && index < 32768;\n};\n\n\n/**\n * Returns true if the element is focusable even when tabIndex is not set.\n * @param {!Element} element Element to check.\n * @return {boolean} Whether the element natively supports focus.\n * @private\n */\ngoog.dom.nativelySupportsFocus_ = function(element) {\n 'use strict';\n return (\n element.tagName == goog.dom.TagName.A && element.hasAttribute('href') ||\n element.tagName == goog.dom.TagName.INPUT ||\n element.tagName == goog.dom.TagName.TEXTAREA ||\n element.tagName == goog.dom.TagName.SELECT ||\n element.tagName == goog.dom.TagName.BUTTON);\n};\n\n\n/**\n * Returns true if the element has a bounding rectangle that would be visible\n * (i.e. its width and height are greater than zero).\n * @param {!HTMLElement} element Element to check.\n * @return {boolean} Whether the element has a non-zero bounding rectangle.\n * @private\n */\ngoog.dom.hasNonZeroBoundingRect_ = function(element) {\n 'use strict';\n var rect;\n if (typeof element['getBoundingClientRect'] !== 'function' ||\n // In IE, getBoundingClientRect throws on detached nodes.\n (goog.userAgent.IE && element.parentElement == null)) {\n rect = {'height': element.offsetHeight, 'width': element.offsetWidth};\n } else {\n rect = element.getBoundingClientRect();\n }\n return rect != null && rect.height > 0 && rect.width > 0;\n};\n\n\n/**\n * Returns the text content of the current node, without markup and invisible\n * symbols. New lines are stripped and whitespace is collapsed,\n * such that each character would be visible.\n *\n * In browsers that support it, innerText is used. Other browsers attempt to\n * simulate it via node traversal. Line breaks are canonicalized in IE.\n *\n * @param {Node} node The node from which we are getting content.\n * @return {string} The text content.\n */\ngoog.dom.getTextContent = function(node) {\n 'use strict';\n var textContent;\n var buf = [];\n goog.dom.getTextContent_(node, buf, true);\n textContent = buf.join('');\n\n // Strip &shy; entities. goog.format.insertWordBreaks inserts them in Opera.\n textContent = textContent.replace(/ \\xAD /g, ' ').replace(/\\xAD/g, '');\n // Strip &#8203; entities. goog.format.insertWordBreaks inserts them in IE8.\n textContent = textContent.replace(/\\u200B/g, '');\n\n textContent = textContent.replace(/ +/g, ' ');\n if (textContent != ' ') {\n textContent = textContent.replace(/^\\s*/, '');\n }\n\n return textContent;\n};\n\n\n/**\n * Returns the text content of the current node, without markup.\n *\n * Unlike `getTextContent` this method does not collapse whitespaces\n * or normalize lines breaks.\n *\n * @param {Node} node The node from which we are getting content.\n * @return {string} The raw text content.\n */\ngoog.dom.getRawTextContent = function(node) {\n 'use strict';\n var buf = [];\n goog.dom.getTextContent_(node, buf, false);\n\n return buf.join('');\n};\n\n\n/**\n * Recursive support function for text content retrieval.\n *\n * @param {Node} node The node from which we are getting content.\n * @param {Array<string>} buf string buffer.\n * @param {boolean} normalizeWhitespace Whether to normalize whitespace.\n * @private\n */\ngoog.dom.getTextContent_ = function(node, buf, normalizeWhitespace) {\n 'use strict';\n if (node.nodeName in goog.dom.TAGS_TO_IGNORE_) {\n // ignore certain tags\n } else if (node.nodeType == goog.dom.NodeType.TEXT) {\n if (normalizeWhitespace) {\n buf.push(String(node.nodeValue).replace(/(\\r\\n|\\r|\\n)/g, ''));\n } else {\n buf.push(node.nodeValue);\n }\n } else if (node.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {\n buf.push(goog.dom.PREDEFINED_TAG_VALUES_[node.nodeName]);\n } else {\n var child = node.firstChild;\n while (child) {\n goog.dom.getTextContent_(child, buf, normalizeWhitespace);\n child = child.nextSibling;\n }\n }\n};\n\n\n/**\n * Returns the text length of the text contained in a node, without markup. This\n * is equivalent to the selection length if the node was selected, or the number\n * of cursor movements to traverse the node. Images & BRs take one space. New\n * lines are ignored.\n *\n * @param {Node} node The node whose text content length is being calculated.\n * @return {number} The length of `node`'s text content.\n */\ngoog.dom.getNodeTextLength = function(node) {\n 'use strict';\n return goog.dom.getTextContent(node).length;\n};\n\n\n/**\n * Returns the text offset of a node relative to one of its ancestors. The text\n * length is the same as the length calculated by goog.dom.getNodeTextLength.\n *\n * @param {Node} node The node whose offset is being calculated.\n * @param {Node=} opt_offsetParent The node relative to which the offset will\n * be calculated. Defaults to the node's owner document's body.\n * @return {number} The text offset.\n */\ngoog.dom.getNodeTextOffset = function(node, opt_offsetParent) {\n 'use strict';\n var root = opt_offsetParent || goog.dom.getOwnerDocument(node).body;\n var buf = [];\n while (node && node != root) {\n var cur = node;\n while ((cur = cur.previousSibling)) {\n buf.unshift(goog.dom.getTextContent(cur));\n }\n node = node.parentNode;\n }\n // Trim left to deal with FF cases when there might be line breaks and empty\n // nodes at the front of the text\n return goog.string.trimLeft(buf.join('')).replace(/ +/g, ' ').length;\n};\n\n\n/**\n * Returns the node at a given offset in a parent node. If an object is\n * provided for the optional third parameter, the node and the remainder of the\n * offset will stored as properties of this object.\n * @param {Node} parent The parent node.\n * @param {number} offset The offset into the parent node.\n * @param {Object=} opt_result Object to be used to store the return value. The\n * return value will be stored in the form {node: Node, remainder: number}\n * if this object is provided.\n * @return {Node} The node at the given offset.\n */\ngoog.dom.getNodeAtOffset = function(parent, offset, opt_result) {\n 'use strict';\n var stack = [parent], pos = 0, cur = null;\n while (stack.length > 0 && pos < offset) {\n cur = stack.pop();\n if (cur.nodeName in goog.dom.TAGS_TO_IGNORE_) {\n // ignore certain tags\n } else if (cur.nodeType == goog.dom.NodeType.TEXT) {\n var text = cur.nodeValue.replace(/(\\r\\n|\\r|\\n)/g, '').replace(/ +/g, ' ');\n pos += text.length;\n } else if (cur.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {\n pos += goog.dom.PREDEFINED_TAG_VALUES_[cur.nodeName].length;\n } else {\n for (var i = cur.childNodes.length - 1; i >= 0; i--) {\n stack.push(cur.childNodes[i]);\n }\n }\n }\n if (goog.isObject(opt_result)) {\n opt_result.remainder = cur ? cur.nodeValue.length + offset - pos - 1 : 0;\n opt_result.node = cur;\n }\n\n return cur;\n};\n\n\n/**\n * Returns true if the object is a `NodeList`. To qualify as a NodeList,\n * the object must have a numeric length property and an item function (which\n * has type 'string' on IE for some reason).\n * @param {Object} val Object to test.\n * @return {boolean} Whether the object is a NodeList.\n */\ngoog.dom.isNodeList = function(val) {\n 'use strict';\n // TODO(attila): Now the isNodeList is part of goog.dom we can use\n // goog.userAgent to make this simpler.\n // A NodeList must have a length property of type 'number' on all platforms.\n if (val && typeof val.length == 'number') {\n // A NodeList is an object everywhere except Safari, where it's a function.\n if (goog.isObject(val)) {\n // A NodeList must have an item function (on non-IE platforms) or an item\n // property of type 'string' (on IE).\n return typeof val.item == 'function' || typeof val.item == 'string';\n } else if (typeof val === 'function') {\n // On Safari, a NodeList is a function with an item property that is also\n // a function.\n return typeof /** @type {?} */ (val.item) == 'function';\n }\n }\n\n // Not a NodeList.\n return false;\n};\n\n\n/**\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\n * tag name and/or class name. If the passed element matches the specified\n * criteria, the element itself is returned.\n * @param {Node} element The DOM node to start with.\n * @param {?(goog.dom.TagName<T>|string)=} opt_tag The tag name to match (or\n * null/undefined to match only based on class name).\n * @param {?string=} opt_class The class name to match (or null/undefined to\n * match only based on tag name).\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\n * dom.\n * @return {?R} The first ancestor that matches the passed criteria, or\n * null if no match is found. The return type is {?Element} if opt_tag is\n * not a member of goog.dom.TagName or a more specific type if it is (e.g.\n * {?HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.getAncestorByTagNameAndClass = function(\n element, opt_tag, opt_class, opt_maxSearchSteps) {\n 'use strict';\n if (!opt_tag && !opt_class) {\n return null;\n }\n var tagName = opt_tag ? String(opt_tag).toUpperCase() : null;\n return /** @type {Element} */ (goog.dom.getAncestor(element, function(node) {\n 'use strict';\n return (!tagName || node.nodeName == tagName) &&\n (!opt_class ||\n typeof node.className === 'string' &&\n goog.array.contains(node.className.split(/\\s+/), opt_class));\n }, true, opt_maxSearchSteps));\n};\n\n\n/**\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\n * class name. If the passed element matches the specified criteria, the\n * element itself is returned.\n * @param {Node} element The DOM node to start with.\n * @param {string} className The class name to match.\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\n * dom.\n * @return {Element} The first ancestor that matches the passed criteria, or\n * null if none match.\n */\ngoog.dom.getAncestorByClass = function(element, className, opt_maxSearchSteps) {\n 'use strict';\n return goog.dom.getAncestorByTagNameAndClass(\n element, null, className, opt_maxSearchSteps);\n};\n\n\n/**\n * Walks up the DOM hierarchy returning the first ancestor that passes the\n * matcher function.\n * @param {Node} element The DOM node to start with.\n * @param {function(!Node) : boolean} matcher A function that returns true if\n * the passed node matches the desired criteria.\n * @param {boolean=} opt_includeNode If true, the node itself is included in\n * the search (the first call to the matcher will pass startElement as\n * the node to test).\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\n * dom.\n * @return {Node} DOM node that matched the matcher, or null if there was\n * no match.\n */\ngoog.dom.getAncestor = function(\n element, matcher, opt_includeNode, opt_maxSearchSteps) {\n 'use strict';\n if (element && !opt_includeNode) {\n element = element.parentNode;\n }\n var steps = 0;\n while (element &&\n (opt_maxSearchSteps == null || steps <= opt_maxSearchSteps)) {\n goog.asserts.assert(element.name != 'parentNode');\n if (matcher(element)) {\n return element;\n }\n element = element.parentNode;\n steps++;\n }\n // Reached the root of the DOM without a match\n return null;\n};\n\n\n/**\n * Determines the active element in the given document.\n * @param {Document} doc The document to look in.\n * @return {Element} The active element.\n */\ngoog.dom.getActiveElement = function(doc) {\n 'use strict';\n // While in an iframe, IE9 will throw \"Unspecified error\" when accessing\n // activeElement.\n try {\n var activeElement = doc && doc.activeElement;\n // While not in an iframe, IE9-11 sometimes gives null.\n // While in an iframe, IE11 sometimes returns an empty object.\n return activeElement && activeElement.nodeName ? activeElement : null;\n } catch (e) {\n return null;\n }\n};\n\n\n/**\n * Gives the current devicePixelRatio.\n *\n * By default, this is the value of window.devicePixelRatio (which should be\n * preferred if present).\n *\n * If window.devicePixelRatio is not present, the ratio is calculated with\n * window.matchMedia, if present. Otherwise, gives 1.0.\n *\n * Some browsers (including Chrome) consider the browser zoom level in the pixel\n * ratio, so the value may change across multiple calls.\n *\n * @return {number} The number of actual pixels per virtual pixel.\n */\ngoog.dom.getPixelRatio = function() {\n 'use strict';\n var win = goog.dom.getWindow();\n if (win.devicePixelRatio !== undefined) {\n return win.devicePixelRatio;\n } else if (win.matchMedia) {\n // Should be for IE10 and FF6-17 (this basically clamps to lower)\n // Note that the order of these statements is important\n return goog.dom.matchesPixelRatio_(3) || goog.dom.matchesPixelRatio_(2) ||\n goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(1) ||\n .75;\n }\n return 1;\n};\n\n\n/**\n * Calculates a mediaQuery to check if the current device supports the\n * given actual to virtual pixel ratio.\n * @param {number} pixelRatio The ratio of actual pixels to virtual pixels.\n * @return {number} pixelRatio if applicable, otherwise 0.\n * @private\n */\ngoog.dom.matchesPixelRatio_ = function(pixelRatio) {\n 'use strict';\n var win = goog.dom.getWindow();\n /**\n * Due to the 1:96 fixed ratio of CSS in to CSS px, 1dppx is equivalent to\n * 96dpi.\n * @const {number}\n */\n var dpiPerDppx = 96;\n var query =\n // FF16-17\n '(min-resolution: ' + pixelRatio + 'dppx),' +\n // FF6-15\n '(min--moz-device-pixel-ratio: ' + pixelRatio + '),' +\n // IE10 (this works for the two browsers above too but I don't want to\n // trust the 1:96 fixed ratio magic)\n '(min-resolution: ' + (pixelRatio * dpiPerDppx) + 'dpi)';\n return win.matchMedia(query).matches ? pixelRatio : 0;\n};\n\n\n/**\n * Gets '2d' context of a canvas. Shortcut for canvas.getContext('2d') with a\n * type information.\n * @param {!HTMLCanvasElement|!OffscreenCanvas} canvas\n * @return {!CanvasRenderingContext2D}\n */\ngoog.dom.getCanvasContext2D = function(canvas) {\n 'use strict';\n return /** @type {!CanvasRenderingContext2D} */ (canvas.getContext('2d'));\n};\n\n\n\n/**\n * Create an instance of a DOM helper with a new document object.\n * @param {Document=} opt_document Document object to associate with this\n * DOM helper.\n * @constructor\n */\ngoog.dom.DomHelper = function(opt_document) {\n 'use strict';\n /**\n * Reference to the document object to use\n * @type {!Document}\n * @private\n */\n this.document_ = opt_document || goog.global.document || document;\n};\n\n\n/**\n * Gets the dom helper object for the document where the element resides.\n * @param {Node=} opt_node If present, gets the DomHelper for this node.\n * @return {!goog.dom.DomHelper} The DomHelper.\n */\ngoog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper;\n\n\n/**\n * Sets the document object.\n * @param {!Document} document Document object.\n */\ngoog.dom.DomHelper.prototype.setDocument = function(document) {\n 'use strict';\n this.document_ = document;\n};\n\n\n/**\n * Gets the document object being used by the dom library.\n * @return {!Document} Document object.\n */\ngoog.dom.DomHelper.prototype.getDocument = function() {\n 'use strict';\n return this.document_;\n};\n\n\n/**\n * Alias for `getElementById`. If a DOM node is passed in then we just\n * return that.\n * @param {string|Element} element Element ID or a DOM node.\n * @return {Element} The element with the given ID, or the node passed in.\n */\ngoog.dom.DomHelper.prototype.getElement = function(element) {\n 'use strict';\n return goog.dom.getElementHelper_(this.document_, element);\n};\n\n\n/**\n * Gets an element by id, asserting that the element is found.\n *\n * This is used when an element is expected to exist, and should fail with\n * an assertion error if it does not (if assertions are enabled).\n *\n * @param {string} id Element ID.\n * @return {!Element} The element with the given ID, if it exists.\n */\ngoog.dom.DomHelper.prototype.getRequiredElement = function(id) {\n 'use strict';\n return goog.dom.getRequiredElementHelper_(this.document_, id);\n};\n\n\n/**\n * Alias for `getElement`.\n * @param {string|Element} element Element ID or a DOM node.\n * @return {Element} The element with the given ID, or the node passed in.\n * @deprecated Use {@link goog.dom.DomHelper.prototype.getElement} instead.\n */\ngoog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;\n\n\n/**\n * Gets elements by tag name.\n * @param {!goog.dom.TagName<T>} tagName\n * @param {(!Document|!Element)=} opt_parent Parent element or document where to\n * look for elements. Defaults to document of this DomHelper.\n * @return {!NodeList<R>} List of elements. The members of the list are\n * {!Element} if tagName is not a member of goog.dom.TagName or more\n * specific types if it is (e.g. {!HTMLAnchorElement} for\n * goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.DomHelper.prototype.getElementsByTagName = function(\n tagName, opt_parent) {\n 'use strict';\n var parent = opt_parent || this.document_;\n return parent.getElementsByTagName(String(tagName));\n};\n\n\n/**\n * Looks up elements by both tag and class name, using browser native functions\n * (`querySelectorAll`, `getElementsByTagName` or\n * `getElementsByClassName`) where possible. The returned array is a live\n * NodeList or a static list depending on the code path taken.\n *\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name or * for all\n * tags.\n * @param {?string=} opt_class Optional class name.\n * @param {(Document|Element)=} opt_el Optional element to look in.\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\n * and numerical indices are guaranteed to exist). The members of the array\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\n * specific types if it is (e.g. {!HTMLAnchorElement} for\n * goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(\n opt_tag, opt_class, opt_el) {\n 'use strict';\n return goog.dom.getElementsByTagNameAndClass_(\n this.document_, opt_tag, opt_class, opt_el);\n};\n\n\n/**\n * Gets the first element matching the tag and the class.\n *\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\n * @param {?string=} opt_class Optional class name.\n * @param {(Document|Element)=} opt_el Optional element to look in.\n * @return {?R} Reference to a DOM node. The return type is {?Element} if\n * tagName is a string or a more specific type if it is a member of\n * goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.DomHelper.prototype.getElementByTagNameAndClass = function(\n opt_tag, opt_class, opt_el) {\n 'use strict';\n return goog.dom.getElementByTagNameAndClass_(\n this.document_, opt_tag, opt_class, opt_el);\n};\n\n\n/**\n * Returns an array of all the elements with the provided className.\n * @param {string} className the name of the class to look for.\n * @param {Element|Document=} opt_el Optional element to look in.\n * @return {!IArrayLike<!Element>} The items found with the class name provided.\n */\ngoog.dom.DomHelper.prototype.getElementsByClass = function(className, opt_el) {\n 'use strict';\n var doc = opt_el || this.document_;\n return goog.dom.getElementsByClass(className, doc);\n};\n\n\n/**\n * Returns the first element we find matching the provided class name.\n * @param {string} className the name of the class to look for.\n * @param {(Element|Document)=} opt_el Optional element to look in.\n * @return {Element} The first item found with the class name provided.\n */\ngoog.dom.DomHelper.prototype.getElementByClass = function(className, opt_el) {\n 'use strict';\n var doc = opt_el || this.document_;\n return goog.dom.getElementByClass(className, doc);\n};\n\n\n/**\n * Ensures an element with the given className exists, and then returns the\n * first element with the provided className.\n * @param {string} className the name of the class to look for.\n * @param {(!Element|!Document)=} opt_root Optional element or document to look\n * in.\n * @return {!Element} The first item found with the class name provided.\n * @throws {goog.asserts.AssertionError} Thrown if no element is found.\n */\ngoog.dom.DomHelper.prototype.getRequiredElementByClass = function(\n className, opt_root) {\n 'use strict';\n var root = opt_root || this.document_;\n return goog.dom.getRequiredElementByClass(className, root);\n};\n\n\n/**\n * Alias for `getElementsByTagNameAndClass`.\n * @deprecated Use DomHelper getElementsByTagNameAndClass.\n *\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\n * @param {?string=} opt_class Optional class name.\n * @param {Element=} opt_el Optional element to look in.\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\n * and numerical indices are guaranteed to exist). The members of the array\n * are {!Element} if opt_tag is a string or more specific types if it is\n * a member of goog.dom.TagName (e.g. {!HTMLAnchorElement} for\n * goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.DomHelper.prototype.$$ =\n goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;\n\n\n/**\n * Sets a number of properties on a node.\n * @param {Element} element DOM node to set properties on.\n * @param {Object} properties Hash of property:value pairs.\n */\ngoog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties;\n\n\n/**\n * Gets the dimensions of the viewport.\n * @param {Window=} opt_window Optional window element to test. Defaults to\n * the window of the Dom Helper.\n * @return {!goog.math.Size} Object with values 'width' and 'height'.\n */\ngoog.dom.DomHelper.prototype.getViewportSize = function(opt_window) {\n 'use strict';\n // TODO(arv): This should not take an argument. That breaks the rule of a\n // a DomHelper representing a single frame/window/document.\n return goog.dom.getViewportSize(opt_window || this.getWindow());\n};\n\n\n/**\n * Calculates the height of the document.\n *\n * @return {number} The height of the document.\n */\ngoog.dom.DomHelper.prototype.getDocumentHeight = function() {\n 'use strict';\n return goog.dom.getDocumentHeight_(this.getWindow());\n};\n\n\n/**\n * Typedef for use with goog.dom.createDom and goog.dom.append.\n * @typedef {Object|string|Array|NodeList}\n */\ngoog.dom.Appendable;\n\n\n/**\n * Returns a dom node with a set of attributes. This function accepts varargs\n * for subsequent nodes to be added. Subsequent nodes will be added to the\n * first node as childNodes.\n *\n * So:\n * <code>createDom(goog.dom.TagName.DIV, null, createDom(goog.dom.TagName.P),\n * createDom(goog.dom.TagName.P));</code> would return a div with two child\n * paragraphs\n *\n * An easy way to move all child nodes of an existing element to a new parent\n * element is:\n * <code>createDom(goog.dom.TagName.DIV, null, oldElement.childNodes);</code>\n * which will remove all child nodes from the old element and add them as\n * child nodes of the new DIV.\n *\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\n * of name-value pairs for attributes. If a string, then this is the\n * className of the new element. If an array, the elements will be joined\n * together as the className of the new element.\n * @param {...(goog.dom.Appendable|undefined)} var_args Further DOM nodes or\n * strings for text nodes. If one of the var_args is an array or\n * NodeList, its elements will be added as childNodes instead.\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\n * is a string or a more specific type if it is a member of\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.DomHelper.prototype.createDom = function(\n tagName, opt_attributes, var_args) {\n 'use strict';\n return goog.dom.createDom_(this.document_, arguments);\n};\n\n\n/**\n * Alias for `createDom`.\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\n * of name-value pairs for attributes. If a string, then this is the\n * className of the new element. If an array, the elements will be joined\n * together as the className of the new element.\n * @param {...(goog.dom.Appendable|undefined)} var_args Further DOM nodes or\n * strings for text nodes. If one of the var_args is an array, its children\n * will be added as childNodes instead.\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\n * is a string or a more specific type if it is a member of\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n * @deprecated Use {@link goog.dom.DomHelper.prototype.createDom} instead.\n */\ngoog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;\n\n\n/**\n * Creates a new element.\n * @param {string|!goog.dom.TagName<T>} name Tag to create.\n * @return {R} The new element. The return type is {!Element} if name is\n * a string or a more specific type if it is a member of goog.dom.TagName\n * (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.DomHelper.prototype.createElement = function(name) {\n 'use strict';\n return goog.dom.createElement_(this.document_, name);\n};\n\n\n/**\n * Creates a new text node.\n * @param {number|string} content Content.\n * @return {!Text} The new text node.\n */\ngoog.dom.DomHelper.prototype.createTextNode = function(content) {\n 'use strict';\n return this.document_.createTextNode(String(content));\n};\n\n\n/**\n * Create a table.\n * @param {number} rows The number of rows in the table. Must be >= 1.\n * @param {number} columns The number of columns in the table. Must be >= 1.\n * @param {boolean=} opt_fillWithNbsp If true, fills table entries with\n * `goog.string.Unicode.NBSP` characters.\n * @return {!HTMLElement} The created table.\n */\ngoog.dom.DomHelper.prototype.createTable = function(\n rows, columns, opt_fillWithNbsp) {\n 'use strict';\n return goog.dom.createTable_(\n this.document_, rows, columns, !!opt_fillWithNbsp);\n};\n\n\n/**\n * Converts an HTML into a node or a document fragment. A single Node is used if\n * `html` only generates a single node. If `html` generates multiple\n * nodes then these are put inside a `DocumentFragment`. This is a safe\n * version of `goog.dom.DomHelper#htmlToDocumentFragment` which is now\n * deleted.\n * @param {!goog.html.SafeHtml} html The HTML markup to convert.\n * @return {!Node} The resulting node.\n */\ngoog.dom.DomHelper.prototype.safeHtmlToNode = function(html) {\n 'use strict';\n return goog.dom.safeHtmlToNode_(this.document_, html);\n};\n\n\n/**\n * Returns true if the browser is in \"CSS1-compatible\" (standards-compliant)\n * mode, false otherwise.\n * @return {boolean} True if in CSS1-compatible mode.\n */\ngoog.dom.DomHelper.prototype.isCss1CompatMode = function() {\n 'use strict';\n return goog.dom.isCss1CompatMode_(this.document_);\n};\n\n\n/**\n * Gets the window object associated with the document.\n * @return {!Window} The window associated with the given document.\n */\ngoog.dom.DomHelper.prototype.getWindow = function() {\n 'use strict';\n return goog.dom.getWindow_(this.document_);\n};\n\n\n/**\n * Gets the document scroll element.\n * @return {!Element} Scrolling element.\n */\ngoog.dom.DomHelper.prototype.getDocumentScrollElement = function() {\n 'use strict';\n return goog.dom.getDocumentScrollElement_(this.document_);\n};\n\n\n/**\n * Gets the document scroll distance as a coordinate object.\n * @return {!goog.math.Coordinate} Object with properties 'x' and 'y'.\n */\ngoog.dom.DomHelper.prototype.getDocumentScroll = function() {\n 'use strict';\n return goog.dom.getDocumentScroll_(this.document_);\n};\n\n\n/**\n * Determines the active element in the given document.\n * @param {Document=} opt_doc The document to look in.\n * @return {Element} The active element.\n */\ngoog.dom.DomHelper.prototype.getActiveElement = function(opt_doc) {\n 'use strict';\n return goog.dom.getActiveElement(opt_doc || this.document_);\n};\n\n\n/**\n * Appends a child to a node.\n * @param {Node} parent Parent.\n * @param {Node} child Child.\n */\ngoog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild;\n\n\n/**\n * Appends a node with text or other nodes.\n * @param {!Node} parent The node to append nodes to.\n * @param {...goog.dom.Appendable} var_args The things to append to the node.\n * If this is a Node it is appended as is.\n * If this is a string then a text node is appended.\n * If this is an array like object then fields 0 to length - 1 are appended.\n */\ngoog.dom.DomHelper.prototype.append = goog.dom.append;\n\n\n/**\n * Determines if the given node can contain children, intended to be used for\n * HTML generation.\n *\n * @param {Node} node The node to check.\n * @return {boolean} Whether the node can contain children.\n */\ngoog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren;\n\n\n/**\n * Removes all the child nodes on a DOM node.\n * @param {Node} node Node to remove children from.\n */\ngoog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren;\n\n\n/**\n * Inserts a new node before an existing reference node (i.e., as the previous\n * sibling). If the reference node has no parent, then does nothing.\n * @param {Node} newNode Node to insert.\n * @param {Node} refNode Reference node to insert before.\n */\ngoog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore;\n\n\n/**\n * Inserts a new node after an existing reference node (i.e., as the next\n * sibling). If the reference node has no parent, then does nothing.\n * @param {Node} newNode Node to insert.\n * @param {Node} refNode Reference node to insert after.\n */\ngoog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter;\n\n\n/**\n * Insert a child at a given index. If index is larger than the number of child\n * nodes that the parent currently has, the node is inserted as the last child\n * node.\n * @param {Element} parent The element into which to insert the child.\n * @param {Node} child The element to insert.\n * @param {number} index The index at which to insert the new child node. Must\n * not be negative.\n */\ngoog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt;\n\n\n/**\n * Removes a node from its parent.\n * @param {Node} node The node to remove.\n * @return {Node} The node removed if removed; else, null.\n */\ngoog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode;\n\n\n/**\n * Replaces a node in the DOM tree. Will do nothing if `oldNode` has no\n * parent.\n * @param {Node} newNode Node to insert.\n * @param {Node} oldNode Node to replace.\n */\ngoog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode;\n\n\n/**\n * Replaces child nodes of `target` with child nodes of `source`. This is\n * roughly equivalent to `target.innerHTML = source.innerHTML` which is not\n * compatible with Trusted Types.\n * @param {?Node} target Node to clean and replace its children.\n * @param {?Node} source Node to get the children from. The nodes will be cloned\n * so they will stay in source.\n */\ngoog.dom.DomHelper.prototype.copyContents = goog.dom.copyContents;\n\n\n/**\n * Flattens an element. That is, removes it and replace it with its children.\n * @param {Element} element The element to flatten.\n * @return {Element|undefined} The original element, detached from the document\n * tree, sans children, or undefined if the element was already not in the\n * document.\n */\ngoog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement;\n\n\n/**\n * Returns an array containing just the element children of the given element.\n * @param {Element} element The element whose element children we want.\n * @return {!(Array<!Element>|NodeList<!Element>)} An array or array-like list\n * of just the element children of the given element.\n */\ngoog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren;\n\n\n/**\n * Returns the first child node that is an element.\n * @param {Node} node The node to get the first child element of.\n * @return {Element} The first child node of `node` that is an element.\n */\ngoog.dom.DomHelper.prototype.getFirstElementChild =\n goog.dom.getFirstElementChild;\n\n\n/**\n * Returns the last child node that is an element.\n * @param {Node} node The node to get the last child element of.\n * @return {Element} The last child node of `node` that is an element.\n */\ngoog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild;\n\n\n/**\n * Returns the first next sibling that is an element.\n * @param {Node} node The node to get the next sibling element of.\n * @return {Element} The next sibling of `node` that is an element.\n */\ngoog.dom.DomHelper.prototype.getNextElementSibling =\n goog.dom.getNextElementSibling;\n\n\n/**\n * Returns the first previous sibling that is an element.\n * @param {Node} node The node to get the previous sibling element of.\n * @return {Element} The first previous sibling of `node` that is\n * an element.\n */\ngoog.dom.DomHelper.prototype.getPreviousElementSibling =\n goog.dom.getPreviousElementSibling;\n\n\n/**\n * Returns the next node in source order from the given node.\n * @param {Node} node The node.\n * @return {Node} The next node in the DOM tree, or null if this was the last\n * node.\n */\ngoog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode;\n\n\n/**\n * Returns the previous node in source order from the given node.\n * @param {Node} node The node.\n * @return {Node} The previous node in the DOM tree, or null if this was the\n * first node.\n */\ngoog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode;\n\n\n/**\n * Whether the object looks like a DOM node.\n * @param {?} obj The object being tested for node likeness.\n * @return {boolean} Whether the object looks like a DOM node.\n */\ngoog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike;\n\n\n/**\n * Whether the object looks like an Element.\n * @param {?} obj The object being tested for Element likeness.\n * @return {boolean} Whether the object looks like an Element.\n */\ngoog.dom.DomHelper.prototype.isElement = goog.dom.isElement;\n\n\n/**\n * Returns true if the specified value is a Window object. This includes the\n * global window for HTML pages, and iframe windows.\n * @param {?} obj Variable to test.\n * @return {boolean} Whether the variable is a window.\n */\ngoog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow;\n\n\n/**\n * Returns an element's parent, if it's an Element.\n * @param {Element} element The DOM element.\n * @return {Element} The parent, or null if not an Element.\n */\ngoog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement;\n\n\n/**\n * Whether a node contains another node.\n * @param {Node} parent The node that should contain the other node.\n * @param {Node} descendant The node to test presence of.\n * @return {boolean} Whether the parent node contains the descendant node.\n */\ngoog.dom.DomHelper.prototype.contains = goog.dom.contains;\n\n\n/**\n * Compares the document order of two nodes, returning 0 if they are the same\n * node, a negative number if node1 is before node2, and a positive number if\n * node2 is before node1. Note that we compare the order the tags appear in the\n * document so in the tree <b><i>text</i></b> the B node is considered to be\n * before the I node.\n *\n * @param {Node} node1 The first node to compare.\n * @param {Node} node2 The second node to compare.\n * @return {number} 0 if the nodes are the same node, a negative number if node1\n * is before node2, and a positive number if node2 is before node1.\n */\ngoog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder;\n\n\n/**\n * Find the deepest common ancestor of the given nodes.\n * @param {...Node} var_args The nodes to find a common ancestor of.\n * @return {Node} The common ancestor of the nodes, or null if there is none.\n * null will only be returned if two or more of the nodes are from different\n * documents.\n */\ngoog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor;\n\n\n/**\n * Returns the owner document for a node.\n * @param {Node} node The node to get the document for.\n * @return {!Document} The document owning the node.\n */\ngoog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument;\n\n\n/**\n * Cross browser function for getting the document element of an iframe.\n * @param {Element} iframe Iframe element.\n * @return {!Document} The frame content document.\n */\ngoog.dom.DomHelper.prototype.getFrameContentDocument =\n goog.dom.getFrameContentDocument;\n\n\n/**\n * Cross browser function for getting the window of a frame or iframe.\n * @param {Element} frame Frame element.\n * @return {Window} The window associated with the given frame.\n */\ngoog.dom.DomHelper.prototype.getFrameContentWindow =\n goog.dom.getFrameContentWindow;\n\n\n/**\n * Sets the text content of a node, with cross-browser support.\n * @param {Node} node The node to change the text content of.\n * @param {string|number} text The value that should replace the node's content.\n */\ngoog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent;\n\n\n/**\n * Gets the outerHTML of a node, which islike innerHTML, except that it\n * actually contains the HTML of the node itself.\n * @param {Element} element The element to get the HTML of.\n * @return {string} The outerHTML of the given element.\n */\ngoog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml;\n\n\n/**\n * Finds the first descendant node that matches the filter function. This does\n * a depth first search.\n * @param {Node} root The root of the tree to search.\n * @param {function(Node) : boolean} p The filter function.\n * @return {Node|undefined} The found node or undefined if none is found.\n */\ngoog.dom.DomHelper.prototype.findNode = goog.dom.findNode;\n\n\n/**\n * Finds all the descendant nodes that matches the filter function. This does a\n * depth first search.\n * @param {Node} root The root of the tree to search.\n * @param {function(Node) : boolean} p The filter function.\n * @return {Array<Node>} The found nodes or an empty array if none are found.\n */\ngoog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes;\n\n\n/**\n * Returns true if the element has a tab index that allows it to receive\n * keyboard focus (tabIndex >= 0), false otherwise. Note that some elements\n * natively support keyboard focus, even if they have no tab index.\n * @param {!Element} element Element to check.\n * @return {boolean} Whether the element has a tab index that allows keyboard\n * focus.\n */\ngoog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex;\n\n\n/**\n * Enables or disables keyboard focus support on the element via its tab index.\n * Only elements for which {@link goog.dom.isFocusableTabIndex} returns true\n * (or elements that natively support keyboard focus, like form elements) can\n * receive keyboard focus. See http://go/tabindex for more info.\n * @param {Element} element Element whose tab index is to be changed.\n * @param {boolean} enable Whether to set or remove a tab index on the element\n * that supports keyboard focus.\n */\ngoog.dom.DomHelper.prototype.setFocusableTabIndex =\n goog.dom.setFocusableTabIndex;\n\n\n/**\n * Returns true if the element can be focused, i.e. it has a tab index that\n * allows it to receive keyboard focus (tabIndex >= 0), or it is an element\n * that natively supports keyboard focus.\n * @param {!Element} element Element to check.\n * @return {boolean} Whether the element allows keyboard focus.\n */\ngoog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable;\n\n\n/**\n * Returns the text contents of the current node, without markup. New lines are\n * stripped and whitespace is collapsed, such that each character would be\n * visible.\n *\n * In browsers that support it, innerText is used. Other browsers attempt to\n * simulate it via node traversal. Line breaks are canonicalized in IE.\n *\n * @param {Node} node The node from which we are getting content.\n * @return {string} The text content.\n */\ngoog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent;\n\n\n/**\n * Returns the text length of the text contained in a node, without markup. This\n * is equivalent to the selection length if the node was selected, or the number\n * of cursor movements to traverse the node. Images & BRs take one space. New\n * lines are ignored.\n *\n * @param {Node} node The node whose text content length is being calculated.\n * @return {number} The length of `node`'s text content.\n */\ngoog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength;\n\n\n/**\n * Returns the text offset of a node relative to one of its ancestors. The text\n * length is the same as the length calculated by\n * `goog.dom.getNodeTextLength`.\n *\n * @param {Node} node The node whose offset is being calculated.\n * @param {Node=} opt_offsetParent Defaults to the node's owner document's body.\n * @return {number} The text offset.\n */\ngoog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset;\n\n\n/**\n * Returns the node at a given offset in a parent node. If an object is\n * provided for the optional third parameter, the node and the remainder of the\n * offset will stored as properties of this object.\n * @param {Node} parent The parent node.\n * @param {number} offset The offset into the parent node.\n * @param {Object=} opt_result Object to be used to store the return value. The\n * return value will be stored in the form {node: Node, remainder: number}\n * if this object is provided.\n * @return {Node} The node at the given offset.\n */\ngoog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset;\n\n\n/**\n * Returns true if the object is a `NodeList`. To qualify as a NodeList,\n * the object must have a numeric length property and an item function (which\n * has type 'string' on IE for some reason).\n * @param {Object} val Object to test.\n * @return {boolean} Whether the object is a NodeList.\n */\ngoog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList;\n\n\n/**\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\n * tag name and/or class name. If the passed element matches the specified\n * criteria, the element itself is returned.\n * @param {Node} element The DOM node to start with.\n * @param {?(goog.dom.TagName<T>|string)=} opt_tag The tag name to match (or\n * null/undefined to match only based on class name).\n * @param {?string=} opt_class The class name to match (or null/undefined to\n * match only based on tag name).\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\n * dom.\n * @return {?R} The first ancestor that matches the passed criteria, or\n * null if no match is found. The return type is {?Element} if opt_tag is\n * not a member of goog.dom.TagName or a more specific type if it is (e.g.\n * {?HTMLAnchorElement} for goog.dom.TagName.A).\n * @template T\n * @template R := cond(isUnknown(T), 'Element', T) =:\n */\ngoog.dom.DomHelper.prototype.getAncestorByTagNameAndClass =\n goog.dom.getAncestorByTagNameAndClass;\n\n\n/**\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\n * class name. If the passed element matches the specified criteria, the\n * element itself is returned.\n * @param {Node} element The DOM node to start with.\n * @param {string} class The class name to match.\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\n * dom.\n * @return {Element} The first ancestor that matches the passed criteria, or\n * null if none match.\n */\ngoog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass;\n\n\n/**\n * Walks up the DOM hierarchy returning the first ancestor that passes the\n * matcher function.\n * @param {Node} element The DOM node to start with.\n * @param {function(Node) : boolean} matcher A function that returns true if the\n * passed node matches the desired criteria.\n * @param {boolean=} opt_includeNode If true, the node itself is included in\n * the search (the first call to the matcher will pass startElement as\n * the node to test).\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\n * dom.\n * @return {Node} DOM node that matched the matcher, or null if there was\n * no match.\n */\ngoog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor;\n\n\n/**\n * Gets '2d' context of a canvas. Shortcut for canvas.getContext('2d') with a\n * type information.\n * @param {!HTMLCanvasElement} canvas\n * @return {!CanvasRenderingContext2D}\n */\ngoog.dom.DomHelper.prototype.getCanvasContext2D = goog.dom.getCanvasContext2D;\n","~:compiled-at",1684858197985,"~:source-map-json","{\n\"version\":3,\n\"file\":\"goog.dom.dom.js\",\n\"lineCount\":1051,\n\"mappings\":\"AAuBAA,IAAKC,CAAAA,OAAL,CAAa,UAAb,CAAA;AACAD,IAAKC,CAAAA,OAAL,CAAa,qBAAb,CAAA;AACAD,IAAKC,CAAAA,OAAL,CAAa,oBAAb,CAAA;AAEAD,IAAKE,CAAAA,OAAL,CAAa,YAAb,CAAA;AACAF,IAAKE,CAAAA,OAAL,CAAa,cAAb,CAAA;AACAF,IAAKE,CAAAA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AvD;AAYAnd,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAUmQ,CAAAA,iBAA7B,GAAiD7d,IAAKG,CAAAA,GAAI0d,CAAAA,iBAA1D;AAYA7d,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAUqQ,CAAAA,iBAA7B,GAAiD/d,IAAKG,CAAAA,GAAI4d,CAAAA,iBAA1D;AAcA/d,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAU0Q,CAAAA,eAA7B,GAA+Cpe,IAAKG,CAAAA,GAAIie,CAAAA,eAAxD;AAUApe,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAUnC,CAAAA,UAA7B,GAA0CvL,IAAKG,CAAAA,GAAIoL,CAAAA,UAAnD;AAqBAvL,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAUkR,CAAAA,4BAA7B,GACI5e,IAAKG,CAAAA,GAAIye,CAAAA,4BADb;AAeA5e,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAUsR,CAAAA,kBAA7B,GAAkDhf,IAAKG,CAAAA,GAAI6e,CAAAA,kBAA3D;AAiBAhf,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAUqR,CAAAA,WAA7B,GAA2C/e,IAAKG,CAAAA,GAAI4e,CAAAA,WAApD;AASA/e,IAAKG,CAAAA,GAAIQ,CAAAA,SAAU+M,CAAAA,SAAUwS,CAAAA,kBAA7B,GAAkDlgB,IAAKG,CAAAA,GAAI+f,CAAAA,kBAA3D;;\",\n\"sources\":[\"goog/dom/dom.js\"],\n\"sourcesContent\":[\"/**\\n * @license\\n * Copyright The Closure Library Authors.\\n * SPDX-License-Identifier: Apache-2.0\\n */\\n\\n/**\\n * @fileoverview Utilities for manipulating the browser's Document Object Model\\n * Inspiration taken *heavily* from mochikit (http://mochikit.com/).\\n *\\n * You can use {@link goog.dom.DomHelper} to create new dom helpers that refer\\n * to a different document object. This is useful if you are working with\\n * frames or multiple windows.\\n *\\n * @suppress {strictMissingProperties}\\n */\\n\\n\\n// TODO(arv): Rename/refactor getTextContent and getRawTextContent. The problem\\n// is that getTextContent should mimic the DOM3 textContent. We should add a\\n// getInnerText (or getText) which tries to return the visible text, innerText.\\n\\n\\ngoog.provide('goog.dom');\\ngoog.provide('goog.dom.Appendable');\\ngoog.provide('goog.dom.DomHelper');\\n\\ngoog.require('goog.array');\\ngoog.require('goog.asserts');\\ngoog.require('goog.asserts.dom');\\ngoog.require('goog.dom.BrowserFeature');\\ngoog.require('goog.dom.NodeType');\\ngoog.require('goog.dom.TagName');\\ngoog.require('goog.dom.safe');\\ngoog.require('goog.html.SafeHtml');\\ngoog.require('goog.html.uncheckedconversions');\\ngoog.require('goog.math.Coordinate');\\ngoog.require('goog.math.Size');\\ngoog.require('goog.object');\\ngoog.require('goog.string');\\ngoog.require('goog.string.Const');\\ngoog.require('goog.string.Unicode');\\ngoog.require('goog.userAgent');\\n\\n\\n/**\\n * @define {boolean} Whether we know at compile time that the browser is in\\n * quirks mode.\\n */\\ngoog.dom.ASSUME_QUIRKS_MODE = goog.define('goog.dom.ASSUME_QUIRKS_MODE', false);\\n\\n\\n/**\\n * @define {boolean} Whether we know at compile time that the browser is in\\n * standards compliance mode.\\n */\\ngoog.dom.ASSUME_STANDARDS_MODE =\\n goog.define('goog.dom.ASSUME_STANDARDS_MODE', false);\\n\\n\\n/**\\n * Whether we know the compatibility mode at compile time.\\n * @type {boolean}\\n * @private\\n */\\ngoog.dom.COMPAT_MODE_KNOWN_ =\\n goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE;\\n\\n\\n/**\\n * Gets the DomHelper object for the document where the element resides.\\n * @param {(Node|Window)=} opt_element If present, gets the DomHelper for this\\n * element.\\n * @return {!goog.dom.DomHelper} The DomHelper.\\n */\\ngoog.dom.getDomHelper = function(opt_element) {\\n 'use strict';\\n return opt_element ?\\n new goog.dom.DomHelper(goog.dom.getOwnerDocument(opt_element)) :\\n (goog.dom.defaultDomHelper_ ||\\n (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper()));\\n};\\n\\n\\n/**\\n * Cached default DOM helper.\\n * @type {!goog.dom.DomHelper|undefined}\\n * @private\\n */\\ngoog.dom.defaultDomHelper_;\\n\\n\\n/**\\n * Gets the document object being used by the dom library.\\n * @return {!Document} Document object.\\n */\\ngoog.dom.getDocument = function() {\\n 'use strict';\\n return document;\\n};\\n\\n\\n/**\\n * Gets an element from the current document by element id.\\n *\\n * If an Element is passed in, it is returned.\\n *\\n * @param {string|Element} element Element ID or a DOM node.\\n * @return {Element} The element with the given ID, or the node passed in.\\n */\\ngoog.dom.getElement = function(element) {\\n 'use strict';\\n return goog.dom.getElementHelper_(document, element);\\n};\\n\\n\\n/**\\n * Gets an HTML element from the current document by element id.\\n *\\n * @param {string} id\\n * @return {?HTMLElement} The element with the given ID or null if no such\\n * element exists.\\n */\\ngoog.dom.getHTMLElement = function(id) {\\n 'use strict'\\n const element = goog.dom.getElement(id);\\n if (!element) {\\n return null;\\n }\\n return goog.asserts.dom.assertIsHtmlElement(element);\\n};\\n\\n\\n/**\\n * Gets an element by id from the given document (if present).\\n * If an element is given, it is returned.\\n * @param {!Document} doc\\n * @param {string|Element} element Element ID or a DOM node.\\n * @return {Element} The resulting element.\\n * @private\\n */\\ngoog.dom.getElementHelper_ = function(doc, element) {\\n 'use strict';\\n return typeof element === 'string' ? doc.getElementById(element) : element;\\n};\\n\\n\\n/**\\n * Gets an element by id, asserting that the element is found.\\n *\\n * This is used when an element is expected to exist, and should fail with\\n * an assertion error if it does not (if assertions are enabled).\\n *\\n * @param {string} id Element ID.\\n * @return {!Element} The element with the given ID, if it exists.\\n */\\ngoog.dom.getRequiredElement = function(id) {\\n 'use strict';\\n return goog.dom.getRequiredElementHelper_(document, id);\\n};\\n\\n\\n/**\\n * Gets an HTML element by id, asserting that the element is found.\\n *\\n * This is used when an element is expected to exist, and should fail with\\n * an assertion error if it does not (if assertions are enabled).\\n *\\n * @param {string} id Element ID.\\n * @return {!HTMLElement} The element with the given ID, if it exists.\\n */\\ngoog.dom.getRequiredHTMLElement = function(id) {\\n 'use strict'\\n return goog.asserts.dom.assertIsHtmlElement(\\n goog.dom.getRequiredElementHelper_(document, id));\\n};\\n\\n\\n/**\\n * Helper function for getRequiredElementHelper functions, both static and\\n * on DomHelper. Asserts the element with the given id exists.\\n * @param {!Document} doc\\n * @param {string} id\\n * @return {!Element} The element with the given ID, if it exists.\\n * @private\\n */\\ngoog.dom.getRequiredElementHelper_ = function(doc, id) {\\n 'use strict';\\n // To prevent users passing in Elements as is permitted in getElement().\\n goog.asserts.assertString(id);\\n var element = goog.dom.getElementHelper_(doc, id);\\n return goog.asserts.assert(element, 'No element found with id: ' + id);\\n};\\n\\n\\n/**\\n * Alias for getElement.\\n * @param {string|Element} element Element ID or a DOM node.\\n * @return {Element} The element with the given ID, or the node passed in.\\n * @deprecated Use {@link goog.dom.getElement} instead.\\n */\\ngoog.dom.$ = goog.dom.getElement;\\n\\n\\n/**\\n * Gets elements by tag name.\\n * @param {!goog.dom.TagName<T>} tagName\\n * @param {(!Document|!Element)=} opt_parent Parent element or document where to\\n * look for elements. Defaults to document.\\n * @return {!NodeList<R>} List of elements. The members of the list are\\n * {!Element} if tagName is not a member of goog.dom.TagName or more\\n * specific types if it is (e.g. {!HTMLAnchorElement} for\\n * goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.getElementsByTagName = function(tagName, opt_parent) {\\n 'use strict';\\n var parent = opt_parent || document;\\n return parent.getElementsByTagName(String(tagName));\\n};\\n\\n\\n/**\\n * Looks up elements by both tag and class name, using browser native functions\\n * (`querySelectorAll`, `getElementsByTagName` or\\n * `getElementsByClassName`) where possible. This function\\n * is a useful, if limited, way of collecting a list of DOM elements\\n * with certain characteristics. `querySelectorAll` offers a\\n * more powerful and general solution which allows matching on CSS3\\n * selector expressions.\\n *\\n * Note that tag names are case sensitive in the SVG namespace, and this\\n * function converts opt_tag to uppercase for comparisons. For queries in the\\n * SVG namespace you should use querySelector or querySelectorAll instead.\\n * https://bugzilla.mozilla.org/show_bug.cgi?id=963870\\n * https://bugs.webkit.org/show_bug.cgi?id=83438\\n *\\n * @see {https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll}\\n *\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\\n * @param {?string=} opt_class Optional class name.\\n * @param {(Document|Element)=} opt_el Optional element to look in.\\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\\n * and numerical indices are guaranteed to exist). The members of the array\\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\\n * specific types if it is (e.g. {!HTMLAnchorElement} for\\n * goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\\n 'use strict';\\n return goog.dom.getElementsByTagNameAndClass_(\\n document, opt_tag, opt_class, opt_el);\\n};\\n\\n\\n/**\\n * Gets the first element matching the tag and the class.\\n *\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\\n * @param {?string=} opt_class Optional class name.\\n * @param {(Document|Element)=} opt_el Optional element to look in.\\n * @return {?R} Reference to a DOM node. The return type is {?Element} if\\n * tagName is a string or a more specific type if it is a member of\\n * goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.getElementByTagNameAndClass = function(opt_tag, opt_class, opt_el) {\\n 'use strict';\\n return goog.dom.getElementByTagNameAndClass_(\\n document, opt_tag, opt_class, opt_el);\\n};\\n\\n\\n/**\\n * Returns a static, array-like list of the elements with the provided\\n * className.\\n *\\n * @param {string} className the name of the class to look for.\\n * @param {(Document|Element)=} opt_el Optional element to look in.\\n * @return {!IArrayLike<!Element>} The items found with the class name provided.\\n */\\ngoog.dom.getElementsByClass = function(className, opt_el) {\\n 'use strict';\\n var parent = opt_el || document;\\n if (goog.dom.canUseQuerySelector_(parent)) {\\n return parent.querySelectorAll('.' + className);\\n }\\n return goog.dom.getElementsByTagNameAndClass_(\\n document, '*', className, opt_el);\\n};\\n\\n\\n/**\\n * Returns the first element with the provided className.\\n *\\n * @param {string} className the name of the class to look for.\\n * @param {Element|Document=} opt_el Optional element to look in.\\n * @return {Element} The first item with the class name provided.\\n */\\ngoog.dom.getElementByClass = function(className, opt_el) {\\n 'use strict';\\n var parent = opt_el || document;\\n var retVal = null;\\n if (parent.getElementsByClassName) {\\n retVal = parent.getElementsByClassName(className)[0];\\n } else {\\n retVal =\\n goog.dom.getElementByTagNameAndClass_(document, '*', className, opt_el);\\n }\\n return retVal || null;\\n};\\n\\n\\n/**\\n * Returns the first element with the provided className and asserts that it is\\n * an HTML element.\\n *\\n * @param {string} className the name of the class to look for.\\n * @param {!Element|!Document=} opt_parent Optional element to look in.\\n * @return {?HTMLElement} The first item with the class name provided.\\n */\\ngoog.dom.getHTMLElementByClass = function(className, opt_parent) {\\n 'use strict'\\n const element = goog.dom.getElementByClass(className, opt_parent);\\n if (!element) {\\n return null;\\n }\\n return goog.asserts.dom.assertIsHtmlElement(element);\\n};\\n\\n\\n/**\\n * Ensures an element with the given className exists, and then returns the\\n * first element with the provided className.\\n *\\n * @param {string} className the name of the class to look for.\\n * @param {!Element|!Document=} opt_root Optional element or document to look\\n * in.\\n * @return {!Element} The first item with the class name provided.\\n * @throws {goog.asserts.AssertionError} Thrown if no element is found.\\n */\\ngoog.dom.getRequiredElementByClass = function(className, opt_root) {\\n 'use strict';\\n var retValue = goog.dom.getElementByClass(className, opt_root);\\n return goog.asserts.assert(\\n retValue, 'No element found with className: ' + className);\\n};\\n\\n\\n/**\\n * Ensures an element with the given className exists, and then returns the\\n * first element with the provided className after asserting that it is an\\n * HTML element.\\n *\\n * @param {string} className the name of the class to look for.\\n * @param {!Element|!Document=} opt_parent Optional element or document to look\\n * in.\\n * @return {!HTMLElement} The first item with the class name provided.\\n */\\ngoog.dom.getRequiredHTMLElementByClass = function(className, opt_parent) {\\n 'use strict'\\n const retValue = goog.dom.getElementByClass(className, opt_parent);\\n goog.asserts.assert(\\n retValue, 'No HTMLElement found with className: ' + className);\\n return goog.asserts.dom.assertIsHtmlElement(retValue);\\n};\\n\\n\\n/**\\n * Prefer the standardized (http://www.w3.org/TR/selectors-api/), native and\\n * fast W3C Selectors API.\\n * @param {!(Element|Document)} parent The parent document object.\\n * @return {boolean} whether or not we can use parent.querySelector* APIs.\\n * @private\\n */\\ngoog.dom.canUseQuerySelector_ = function(parent) {\\n 'use strict';\\n return !!(parent.querySelectorAll && parent.querySelector);\\n};\\n\\n\\n/**\\n * Helper for `getElementsByTagNameAndClass`.\\n * @param {!Document} doc The document to get the elements in.\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\\n * @param {?string=} opt_class Optional class name.\\n * @param {(Document|Element)=} opt_el Optional element to look in.\\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\\n * and numerical indices are guaranteed to exist). The members of the array\\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\\n * specific types if it is (e.g. {!HTMLAnchorElement} for\\n * goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n * @private\\n */\\ngoog.dom.getElementsByTagNameAndClass_ = function(\\n doc, opt_tag, opt_class, opt_el) {\\n 'use strict';\\n var parent = opt_el || doc;\\n var tagName =\\n (opt_tag && opt_tag != '*') ? String(opt_tag).toUpperCase() : '';\\n\\n if (goog.dom.canUseQuerySelector_(parent) && (tagName || opt_class)) {\\n var query = tagName + (opt_class ? '.' + opt_class : '');\\n return parent.querySelectorAll(query);\\n }\\n\\n // Use the native getElementsByClassName if available, under the assumption\\n // that even when the tag name is specified, there will be fewer elements to\\n // filter through when going by class than by tag name\\n if (opt_class && parent.getElementsByClassName) {\\n var els = parent.getElementsByClassName(opt_class);\\n\\n if (tagName) {\\n var arrayLike = {};\\n var len = 0;\\n\\n // Filter for specific tags if requested.\\n for (var i = 0, el; el = els[i]; i++) {\\n if (tagName == el.nodeName) {\\n arrayLike[len++] = el;\\n }\\n }\\n arrayLike.length = len;\\n\\n return /** @type {!IArrayLike<!Element>} */ (arrayLike);\\n } else {\\n return els;\\n }\\n }\\n\\n var els = parent.getElementsByTagName(tagName || '*');\\n\\n if (opt_class) {\\n var arrayLike = {};\\n var len = 0;\\n for (var i = 0, el; el = els[i]; i++) {\\n var className = el.className;\\n // Check if className has a split function since SVG className does not.\\n if (typeof className.split == 'function' &&\\n goog.array.contains(className.split(/\\\\s+/), opt_class)) {\\n arrayLike[len++] = el;\\n }\\n }\\n arrayLike.length = len;\\n return /** @type {!IArrayLike<!Element>} */ (arrayLike);\\n } else {\\n return els;\\n }\\n};\\n\\n\\n/**\\n * Helper for goog.dom.getElementByTagNameAndClass.\\n *\\n * @param {!Document} doc The document to get the elements in.\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\\n * @param {?string=} opt_class Optional class name.\\n * @param {(Document|Element)=} opt_el Optional element to look in.\\n * @return {?R} Reference to a DOM node. The return type is {?Element} if\\n * tagName is a string or a more specific type if it is a member of\\n * goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n * @private\\n */\\ngoog.dom.getElementByTagNameAndClass_ = function(\\n doc, opt_tag, opt_class, opt_el) {\\n 'use strict';\\n var parent = opt_el || doc;\\n var tag = (opt_tag && opt_tag != '*') ? String(opt_tag).toUpperCase() : '';\\n if (goog.dom.canUseQuerySelector_(parent) && (tag || opt_class)) {\\n return parent.querySelector(tag + (opt_class ? '.' + opt_class : ''));\\n }\\n var elements =\\n goog.dom.getElementsByTagNameAndClass_(doc, opt_tag, opt_class, opt_el);\\n return elements[0] || null;\\n};\\n\\n\\n\\n/**\\n * Alias for `getElementsByTagNameAndClass`.\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\\n * @param {?string=} opt_class Optional class name.\\n * @param {Element=} opt_el Optional element to look in.\\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\\n * and numerical indices are guaranteed to exist). The members of the array\\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\\n * specific types if it is (e.g. {!HTMLAnchorElement} for\\n * goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n * @deprecated Use {@link goog.dom.getElementsByTagNameAndClass} instead.\\n */\\ngoog.dom.$$ = goog.dom.getElementsByTagNameAndClass;\\n\\n\\n/**\\n * Sets multiple properties, and sometimes attributes, on an element. Note that\\n * properties are simply object properties on the element instance, while\\n * attributes are visible in the DOM. Many properties map to attributes with the\\n * same names, some with different names, and there are also unmappable cases.\\n *\\n * This method sets properties by default (which means that custom attributes\\n * are not supported). These are the exeptions (some of which is legacy):\\n * - \\\"style\\\": Even though this is an attribute name, it is translated to a\\n * property, \\\"style.cssText\\\". Note that this property sanitizes and formats\\n * its value, unlike the attribute.\\n * - \\\"class\\\": This is an attribute name, it is translated to the \\\"className\\\"\\n * property.\\n * - \\\"for\\\": This is an attribute name, it is translated to the \\\"htmlFor\\\"\\n * property.\\n * - Entries in {@see goog.dom.DIRECT_ATTRIBUTE_MAP_} are set as attributes,\\n * this is probably due to browser quirks.\\n * - \\\"aria-*\\\", \\\"data-*\\\": Always set as attributes, they have no property\\n * counterparts.\\n *\\n * @param {Element} element DOM node to set properties on.\\n * @param {Object} properties Hash of property:value pairs.\\n * Property values can be strings or goog.string.TypedString values (such as\\n * goog.html.SafeUrl).\\n */\\ngoog.dom.setProperties = function(element, properties) {\\n 'use strict';\\n goog.object.forEach(properties, function(val, key) {\\n 'use strict';\\n if (val && typeof val == 'object' && val.implementsGoogStringTypedString) {\\n val = val.getTypedStringValue();\\n }\\n if (key == 'style') {\\n element.style.cssText = val;\\n } else if (key == 'class') {\\n element.className = val;\\n } else if (key == 'for') {\\n element.htmlFor = val;\\n } else if (goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(key)) {\\n element.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[key], val);\\n } else if (\\n goog.string.startsWith(key, 'aria-') ||\\n goog.string.startsWith(key, 'data-')) {\\n element.setAttribute(key, val);\\n } else {\\n element[key] = val;\\n }\\n });\\n};\\n\\n\\n/**\\n * Map of attributes that should be set using\\n * element.setAttribute(key, val) instead of element[key] = val. Used\\n * by goog.dom.setProperties.\\n *\\n * @private {!Object<string, string>}\\n * @const\\n */\\ngoog.dom.DIRECT_ATTRIBUTE_MAP_ = {\\n 'cellpadding': 'cellPadding',\\n 'cellspacing': 'cellSpacing',\\n 'colspan': 'colSpan',\\n 'frameborder': 'frameBorder',\\n 'height': 'height',\\n 'maxlength': 'maxLength',\\n 'nonce': 'nonce',\\n 'role': 'role',\\n 'rowspan': 'rowSpan',\\n 'type': 'type',\\n 'usemap': 'useMap',\\n 'valign': 'vAlign',\\n 'width': 'width'\\n};\\n\\n\\n/**\\n * Gets the dimensions of the viewport.\\n *\\n * Gecko Standards mode:\\n * docEl.clientWidth Width of viewport excluding scrollbar.\\n * win.innerWidth Width of viewport including scrollbar.\\n * body.clientWidth Width of body element.\\n *\\n * docEl.clientHeight Height of viewport excluding scrollbar.\\n * win.innerHeight Height of viewport including scrollbar.\\n * body.clientHeight Height of document.\\n *\\n * Gecko Backwards compatible mode:\\n * docEl.clientWidth Width of viewport excluding scrollbar.\\n * win.innerWidth Width of viewport including scrollbar.\\n * body.clientWidth Width of viewport excluding scrollbar.\\n *\\n * docEl.clientHeight Height of document.\\n * win.innerHeight Height of viewport including scrollbar.\\n * body.clientHeight Height of viewport excluding scrollbar.\\n *\\n * IE6/7 Standards mode:\\n * docEl.clientWidth Width of viewport excluding scrollbar.\\n * win.innerWidth Undefined.\\n * body.clientWidth Width of body element.\\n *\\n * docEl.clientHeight Height of viewport excluding scrollbar.\\n * win.innerHeight Undefined.\\n * body.clientHeight Height of document element.\\n *\\n * IE5 + IE6/7 Backwards compatible mode:\\n * docEl.clientWidth 0.\\n * win.innerWidth Undefined.\\n * body.clientWidth Width of viewport excluding scrollbar.\\n *\\n * docEl.clientHeight 0.\\n * win.innerHeight Undefined.\\n * body.clientHeight Height of viewport excluding scrollbar.\\n *\\n * Opera 9 Standards and backwards compatible mode:\\n * docEl.clientWidth Width of viewport excluding scrollbar.\\n * win.innerWidth Width of viewport including scrollbar.\\n * body.clientWidth Width of viewport excluding scrollbar.\\n *\\n * docEl.clientHeight Height of document.\\n * win.innerHeight Height of viewport including scrollbar.\\n * body.clientHeight Height of viewport excluding scrollbar.\\n *\\n * WebKit:\\n * Safari 2\\n * docEl.clientHeight Same as scrollHeight.\\n * docEl.clientWidth Same as innerWidth.\\n * win.innerWidth Width of viewport excluding scrollbar.\\n * win.innerHeight Height of the viewport including scrollbar.\\n * frame.innerHeight Height of the viewport exluding scrollbar.\\n *\\n * Safari 3 (tested in 522)\\n *\\n * docEl.clientWidth Width of viewport excluding scrollbar.\\n * docEl.clientHeight Height of viewport excluding scrollbar in strict mode.\\n * body.clientHeight Height of viewport excluding scrollbar in quirks mode.\\n *\\n * @param {Window=} opt_window Optional window element to test.\\n * @return {!goog.math.Size} Object with values 'width' and 'height'.\\n */\\ngoog.dom.getViewportSize = function(opt_window) {\\n 'use strict';\\n // TODO(arv): This should not take an argument\\n return goog.dom.getViewportSize_(opt_window || window);\\n};\\n\\n\\n/**\\n * Helper for `getViewportSize`.\\n * @param {Window} win The window to get the view port size for.\\n * @return {!goog.math.Size} Object with values 'width' and 'height'.\\n * @private\\n */\\ngoog.dom.getViewportSize_ = function(win) {\\n 'use strict';\\n var doc = win.document;\\n var el = goog.dom.isCss1CompatMode_(doc) ? doc.documentElement : doc.body;\\n return new goog.math.Size(el.clientWidth, el.clientHeight);\\n};\\n\\n\\n/**\\n * Calculates the height of the document.\\n *\\n * @return {number} The height of the current document.\\n */\\ngoog.dom.getDocumentHeight = function() {\\n 'use strict';\\n return goog.dom.getDocumentHeight_(window);\\n};\\n\\n/**\\n * Calculates the height of the document of the given window.\\n *\\n * @param {!Window} win The window whose document height to retrieve.\\n * @return {number} The height of the document of the given window.\\n */\\ngoog.dom.getDocumentHeightForWindow = function(win) {\\n 'use strict';\\n return goog.dom.getDocumentHeight_(win);\\n};\\n\\n/**\\n * Calculates the height of the document of the given window.\\n *\\n * Function code copied from the opensocial gadget api:\\n * gadgets.window.adjustHeight(opt_height)\\n *\\n * @private\\n * @param {!Window} win The window whose document height to retrieve.\\n * @return {number} The height of the document of the given window.\\n */\\ngoog.dom.getDocumentHeight_ = function(win) {\\n 'use strict';\\n // NOTE(eae): This method will return the window size rather than the document\\n // size in webkit quirks mode.\\n var doc = win.document;\\n var height = 0;\\n\\n if (doc) {\\n // Calculating inner content height is hard and different between\\n // browsers rendering in Strict vs. Quirks mode. We use a combination of\\n // three properties within document.body and document.documentElement:\\n // - scrollHeight\\n // - offsetHeight\\n // - clientHeight\\n // These values differ significantly between browsers and rendering modes.\\n // But there are patterns. It just takes a lot of time and persistence\\n // to figure out.\\n\\n var body = doc.body;\\n var docEl = /** @type {!HTMLElement} */ (doc.documentElement);\\n if (!(docEl && body)) {\\n return 0;\\n }\\n\\n // Get the height of the viewport\\n var vh = goog.dom.getViewportSize_(win).height;\\n if (goog.dom.isCss1CompatMode_(doc) && docEl.scrollHeight) {\\n // In Strict mode:\\n // The inner content height is contained in either:\\n // document.documentElement.scrollHeight\\n // document.documentElement.offsetHeight\\n // Based on studying the values output by different browsers,\\n // use the value that's NOT equal to the viewport height found above.\\n height =\\n docEl.scrollHeight != vh ? docEl.scrollHeight : docEl.offsetHeight;\\n } else {\\n // In Quirks mode:\\n // documentElement.clientHeight is equal to documentElement.offsetHeight\\n // except in IE. In most browsers, document.documentElement can be used\\n // to calculate the inner content height.\\n // However, in other browsers (e.g. IE), document.body must be used\\n // instead. How do we know which one to use?\\n // If document.documentElement.clientHeight does NOT equal\\n // document.documentElement.offsetHeight, then use document.body.\\n var sh = docEl.scrollHeight;\\n var oh = docEl.offsetHeight;\\n if (docEl.clientHeight != oh) {\\n sh = body.scrollHeight;\\n oh = body.offsetHeight;\\n }\\n\\n // Detect whether the inner content height is bigger or smaller\\n // than the bounding box (viewport). If bigger, take the larger\\n // value. If smaller, take the smaller value.\\n if (sh > vh) {\\n // Content is larger\\n height = sh > oh ? sh : oh;\\n } else {\\n // Content is smaller\\n height = sh < oh ? sh : oh;\\n }\\n }\\n }\\n\\n return height;\\n};\\n\\n\\n/**\\n * Gets the page scroll distance as a coordinate object.\\n *\\n * @param {Window=} opt_window Optional window element to test.\\n * @return {!goog.math.Coordinate} Object with values 'x' and 'y'.\\n * @deprecated Use {@link goog.dom.getDocumentScroll} instead.\\n */\\ngoog.dom.getPageScroll = function(opt_window) {\\n 'use strict';\\n var win = opt_window || goog.global || window;\\n return goog.dom.getDomHelper(win.document).getDocumentScroll();\\n};\\n\\n\\n/**\\n * Gets the document scroll distance as a coordinate object.\\n *\\n * @return {!goog.math.Coordinate} Object with values 'x' and 'y'.\\n */\\ngoog.dom.getDocumentScroll = function() {\\n 'use strict';\\n return goog.dom.getDocumentScroll_(document);\\n};\\n\\n\\n/**\\n * Helper for `getDocumentScroll`.\\n *\\n * @param {!Document} doc The document to get the scroll for.\\n * @return {!goog.math.Coordinate} Object with values 'x' and 'y'.\\n * @private\\n */\\ngoog.dom.getDocumentScroll_ = function(doc) {\\n 'use strict';\\n var el = goog.dom.getDocumentScrollElement_(doc);\\n var win = goog.dom.getWindow_(doc);\\n if (goog.userAgent.IE && win.pageYOffset != el.scrollTop) {\\n // The keyboard on IE10 touch devices shifts the page using the pageYOffset\\n // without modifying scrollTop. For this case, we want the body scroll\\n // offsets.\\n return new goog.math.Coordinate(el.scrollLeft, el.scrollTop);\\n }\\n return new goog.math.Coordinate(\\n win.pageXOffset || el.scrollLeft, win.pageYOffset || el.scrollTop);\\n};\\n\\n\\n/**\\n * Gets the document scroll element.\\n * @return {!Element} Scrolling element.\\n */\\ngoog.dom.getDocumentScrollElement = function() {\\n 'use strict';\\n return goog.dom.getDocumentScrollElement_(document);\\n};\\n\\n\\n/**\\n * Helper for `getDocumentScrollElement`.\\n * @param {!Document} doc The document to get the scroll element for.\\n * @return {!Element} Scrolling element.\\n * @private\\n */\\ngoog.dom.getDocumentScrollElement_ = function(doc) {\\n 'use strict';\\n // Old WebKit needs body.scrollLeft in both quirks mode and strict mode. We\\n // also default to the documentElement if the document does not have a body\\n // (e.g. a SVG document).\\n // Uses http://dev.w3.org/csswg/cssom-view/#dom-document-scrollingelement to\\n // avoid trying to guess about browser behavior from the UA string.\\n if (doc.scrollingElement) {\\n return doc.scrollingElement;\\n }\\n if (!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(doc)) {\\n return doc.documentElement;\\n }\\n return doc.body || doc.documentElement;\\n};\\n\\n\\n/**\\n * Gets the window object associated with the given document.\\n *\\n * @param {Document=} opt_doc Document object to get window for.\\n * @return {!Window} The window associated with the given document.\\n */\\ngoog.dom.getWindow = function(opt_doc) {\\n 'use strict';\\n // TODO(arv): This should not take an argument.\\n return opt_doc ? goog.dom.getWindow_(opt_doc) : window;\\n};\\n\\n\\n/**\\n * Helper for `getWindow`.\\n *\\n * @param {!Document} doc Document object to get window for.\\n * @return {!Window} The window associated with the given document.\\n * @private\\n */\\ngoog.dom.getWindow_ = function(doc) {\\n 'use strict';\\n return /** @type {!Window} */ (doc.parentWindow || doc.defaultView);\\n};\\n\\n\\n/**\\n * Returns a dom node with a set of attributes. This function accepts varargs\\n * for subsequent nodes to be added. Subsequent nodes will be added to the\\n * first node as childNodes.\\n *\\n * So:\\n * <code>createDom(goog.dom.TagName.DIV, null, createDom(goog.dom.TagName.P),\\n * createDom(goog.dom.TagName.P));</code> would return a div with two child\\n * paragraphs\\n *\\n * This function uses {@link goog.dom.setProperties} to set attributes: the\\n * `opt_attributes` parameter follows the same rules.\\n *\\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\\n * of name-value pairs for attributes. If a string, then this is the\\n * className of the new element. If an array, the elements will be joined\\n * together as the className of the new element.\\n * @param {...(Object|string|Array|NodeList|null|undefined)} var_args Further\\n * DOM nodes or strings for text nodes. If one of the var_args is an array\\n * or NodeList, its elements will be added as childNodes instead.\\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\\n * is a string or a more specific type if it is a member of\\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.createDom = function(tagName, opt_attributes, var_args) {\\n 'use strict';\\n return goog.dom.createDom_(document, arguments);\\n};\\n\\n\\n/**\\n * Helper for `createDom`.\\n * @param {!Document} doc The document to create the DOM in.\\n * @param {!Arguments} args Argument object passed from the callers. See\\n * `goog.dom.createDom` for details.\\n * @return {!Element} Reference to a DOM node.\\n * @private\\n */\\ngoog.dom.createDom_ = function(doc, args) {\\n 'use strict';\\n var tagName = String(args[0]);\\n var attributes = args[1];\\n\\n var element = goog.dom.createElement_(doc, tagName);\\n\\n if (attributes) {\\n if (typeof attributes === 'string') {\\n element.className = attributes;\\n } else if (Array.isArray(attributes)) {\\n element.className = attributes.join(' ');\\n } else {\\n goog.dom.setProperties(element, attributes);\\n }\\n }\\n\\n if (args.length > 2) {\\n goog.dom.append_(doc, element, args, 2);\\n }\\n\\n return element;\\n};\\n\\n\\n/**\\n * Appends a node with text or other nodes.\\n * @param {!Document} doc The document to create new nodes in.\\n * @param {!Node} parent The node to append nodes to.\\n * @param {!Arguments} args The values to add. See `goog.dom.append`.\\n * @param {number} startIndex The index of the array to start from.\\n * @private\\n */\\ngoog.dom.append_ = function(doc, parent, args, startIndex) {\\n 'use strict';\\n function childHandler(child) {\\n // TODO(user): More coercion, ala MochiKit?\\n if (child) {\\n parent.appendChild(\\n typeof child === 'string' ? doc.createTextNode(child) : child);\\n }\\n }\\n\\n for (var i = startIndex; i < args.length; i++) {\\n var arg = args[i];\\n // TODO(attila): Fix isArrayLike to return false for a text node.\\n if (goog.isArrayLike(arg) && !goog.dom.isNodeLike(arg)) {\\n // If the argument is a node list, not a real array, use a clone,\\n // because forEach can't be used to mutate a NodeList.\\n goog.array.forEach(\\n goog.dom.isNodeList(arg) ? goog.array.toArray(arg) : arg,\\n childHandler);\\n } else {\\n childHandler(arg);\\n }\\n }\\n};\\n\\n\\n/**\\n * Alias for `createDom`.\\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\\n * of name-value pairs for attributes. If a string, then this is the\\n * className of the new element. If an array, the elements will be joined\\n * together as the className of the new element.\\n * @param {...(Object|string|Array|NodeList|null|undefined)} var_args Further\\n * DOM nodes or strings for text nodes. If one of the var_args is an array,\\n * its children will be added as childNodes instead.\\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\\n * is a string or a more specific type if it is a member of\\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n * @deprecated Use {@link goog.dom.createDom} instead.\\n */\\ngoog.dom.$dom = goog.dom.createDom;\\n\\n\\n/**\\n * Creates a new element.\\n * @param {string|!goog.dom.TagName<T>} name Tag to create.\\n * @return {R} The new element. The return type is {!Element} if name is\\n * a string or a more specific type if it is a member of goog.dom.TagName\\n * (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.createElement = function(name) {\\n 'use strict';\\n return goog.dom.createElement_(document, name);\\n};\\n\\n\\n/**\\n * Creates a new element.\\n * @param {!Document} doc The document to create the element in.\\n * @param {string|!goog.dom.TagName<T>} name Tag to create.\\n * @return {R} The new element. The return type is {!Element} if name is\\n * a string or a more specific type if it is a member of goog.dom.TagName\\n * (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n * @private\\n */\\ngoog.dom.createElement_ = function(doc, name) {\\n 'use strict';\\n name = String(name);\\n if (doc.contentType === 'application/xhtml+xml') name = name.toLowerCase();\\n return doc.createElement(name);\\n};\\n\\n\\n/**\\n * Creates a new text node.\\n * @param {number|string} content Content.\\n * @return {!Text} The new text node.\\n */\\ngoog.dom.createTextNode = function(content) {\\n 'use strict';\\n return document.createTextNode(String(content));\\n};\\n\\n\\n/**\\n * Create a table.\\n * @param {number} rows The number of rows in the table. Must be >= 1.\\n * @param {number} columns The number of columns in the table. Must be >= 1.\\n * @param {boolean=} opt_fillWithNbsp If true, fills table entries with\\n * `goog.string.Unicode.NBSP` characters.\\n * @return {!Element} The created table.\\n */\\ngoog.dom.createTable = function(rows, columns, opt_fillWithNbsp) {\\n 'use strict';\\n // TODO(mlourenco): Return HTMLTableElement, also in prototype function.\\n // Callers need to be updated to e.g. not assign numbers to table.cellSpacing.\\n return goog.dom.createTable_(document, rows, columns, !!opt_fillWithNbsp);\\n};\\n\\n\\n/**\\n * Create a table.\\n * @param {!Document} doc Document object to use to create the table.\\n * @param {number} rows The number of rows in the table. Must be >= 1.\\n * @param {number} columns The number of columns in the table. Must be >= 1.\\n * @param {boolean} fillWithNbsp If true, fills table entries with\\n * `goog.string.Unicode.NBSP` characters.\\n * @return {!HTMLTableElement} The created table.\\n * @private\\n */\\ngoog.dom.createTable_ = function(doc, rows, columns, fillWithNbsp) {\\n 'use strict';\\n var table = goog.dom.createElement_(doc, goog.dom.TagName.TABLE);\\n var tbody =\\n table.appendChild(goog.dom.createElement_(doc, goog.dom.TagName.TBODY));\\n for (var i = 0; i < rows; i++) {\\n var tr = goog.dom.createElement_(doc, goog.dom.TagName.TR);\\n for (var j = 0; j < columns; j++) {\\n var td = goog.dom.createElement_(doc, goog.dom.TagName.TD);\\n // IE <= 9 will create a text node if we set text content to the empty\\n // string, so we avoid doing it unless necessary. This ensures that the\\n // same DOM tree is returned on all browsers.\\n if (fillWithNbsp) {\\n goog.dom.setTextContent(td, goog.string.Unicode.NBSP);\\n }\\n tr.appendChild(td);\\n }\\n tbody.appendChild(tr);\\n }\\n return table;\\n};\\n\\n\\n\\n/**\\n * Creates a new Node from constant strings of HTML markup.\\n * @param {...!goog.string.Const} var_args The HTML strings to concatenate then\\n * convert into a node.\\n * @return {!Node}\\n */\\ngoog.dom.constHtmlToNode = function(var_args) {\\n 'use strict';\\n var stringArray =\\n Array.prototype.map.call(arguments, goog.string.Const.unwrap);\\n var safeHtml =\\n goog.html.uncheckedconversions\\n .safeHtmlFromStringKnownToSatisfyTypeContract(\\n goog.string.Const.from(\\n 'Constant HTML string, that gets turned into a ' +\\n 'Node later, so it will be automatically balanced.'),\\n stringArray.join(''));\\n return goog.dom.safeHtmlToNode(safeHtml);\\n};\\n\\n\\n/**\\n * Converts HTML markup into a node. This is a safe version of\\n * `goog.dom.htmlToDocumentFragment` which is now deleted.\\n * @param {!goog.html.SafeHtml} html The HTML markup to convert.\\n * @return {!Node} The resulting node.\\n */\\ngoog.dom.safeHtmlToNode = function(html) {\\n 'use strict';\\n return goog.dom.safeHtmlToNode_(document, html);\\n};\\n\\n\\n/**\\n * Helper for `safeHtmlToNode`.\\n * @param {!Document} doc The document.\\n * @param {!goog.html.SafeHtml} html The HTML markup to convert.\\n * @return {!Node} The resulting node.\\n * @private\\n */\\ngoog.dom.safeHtmlToNode_ = function(doc, html) {\\n 'use strict';\\n var tempDiv = goog.dom.createElement_(doc, goog.dom.TagName.DIV);\\n if (goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT) {\\n goog.dom.safe.setInnerHtml(\\n tempDiv, goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, html));\\n tempDiv.removeChild(goog.asserts.assert(tempDiv.firstChild));\\n } else {\\n goog.dom.safe.setInnerHtml(tempDiv, html);\\n }\\n return goog.dom.childrenToNode_(doc, tempDiv);\\n};\\n\\n\\n/**\\n * Helper for `safeHtmlToNode_`.\\n * @param {!Document} doc The document.\\n * @param {!Node} tempDiv The input node.\\n * @return {!Node} The resulting node.\\n * @private\\n */\\ngoog.dom.childrenToNode_ = function(doc, tempDiv) {\\n 'use strict';\\n if (tempDiv.childNodes.length == 1) {\\n return tempDiv.removeChild(goog.asserts.assert(tempDiv.firstChild));\\n } else {\\n var fragment = doc.createDocumentFragment();\\n while (tempDiv.firstChild) {\\n fragment.appendChild(tempDiv.firstChild);\\n }\\n return fragment;\\n }\\n};\\n\\n\\n/**\\n * Returns true if the browser is in \\\"CSS1-compatible\\\" (standards-compliant)\\n * mode, false otherwise.\\n * @return {boolean} True if in CSS1-compatible mode.\\n */\\ngoog.dom.isCss1CompatMode = function() {\\n 'use strict';\\n return goog.dom.isCss1CompatMode_(document);\\n};\\n\\n\\n/**\\n * Returns true if the browser is in \\\"CSS1-compatible\\\" (standards-compliant)\\n * mode, false otherwise.\\n * @param {!Document} doc The document to check.\\n * @return {boolean} True if in CSS1-compatible mode.\\n * @private\\n */\\ngoog.dom.isCss1CompatMode_ = function(doc) {\\n 'use strict';\\n if (goog.dom.COMPAT_MODE_KNOWN_) {\\n return goog.dom.ASSUME_STANDARDS_MODE;\\n }\\n\\n return doc.compatMode == 'CSS1Compat';\\n};\\n\\n\\n/**\\n * Determines if the given node can contain children, intended to be used for\\n * HTML generation.\\n *\\n * IE natively supports node.canHaveChildren but has inconsistent behavior.\\n * Prior to IE8 the base tag allows children and in IE9 all nodes return true\\n * for canHaveChildren.\\n *\\n * In practice all non-IE browsers allow you to add children to any node, but\\n * the behavior is inconsistent:\\n *\\n * <pre>\\n * var a = goog.dom.createElement(goog.dom.TagName.BR);\\n * a.appendChild(document.createTextNode('foo'));\\n * a.appendChild(document.createTextNode('bar'));\\n * console.log(a.childNodes.length); // 2\\n * console.log(a.innerHTML); // Chrome: \\\"\\\", IE9: \\\"foobar\\\", FF3.5: \\\"foobar\\\"\\n * </pre>\\n *\\n * For more information, see:\\n * http://dev.w3.org/html5/markup/syntax.html#syntax-elements\\n *\\n * TODO(user): Rename shouldAllowChildren() ?\\n *\\n * @param {Node} node The node to check.\\n * @return {boolean} Whether the node can contain children.\\n */\\ngoog.dom.canHaveChildren = function(node) {\\n 'use strict';\\n if (node.nodeType != goog.dom.NodeType.ELEMENT) {\\n return false;\\n }\\n switch (/** @type {!Element} */ (node).tagName) {\\n case String(goog.dom.TagName.APPLET):\\n case String(goog.dom.TagName.AREA):\\n case String(goog.dom.TagName.BASE):\\n case String(goog.dom.TagName.BR):\\n case String(goog.dom.TagName.COL):\\n case String(goog.dom.TagName.COMMAND):\\n case String(goog.dom.TagName.EMBED):\\n case String(goog.dom.TagName.FRAME):\\n case String(goog.dom.TagName.HR):\\n case String(goog.dom.TagName.IMG):\\n case String(goog.dom.TagName.INPUT):\\n case String(goog.dom.TagName.IFRAME):\\n case String(goog.dom.TagName.ISINDEX):\\n case String(goog.dom.TagName.KEYGEN):\\n case String(goog.dom.TagName.LINK):\\n case String(goog.dom.TagName.NOFRAMES):\\n case String(goog.dom.TagName.NOSCRIPT):\\n case String(goog.dom.TagName.META):\\n case String(goog.dom.TagName.OBJECT):\\n case String(goog.dom.TagName.PARAM):\\n case String(goog.dom.TagName.SCRIPT):\\n case String(goog.dom.TagName.SOURCE):\\n case String(goog.dom.TagName.STYLE):\\n case String(goog.dom.TagName.TRACK):\\n case String(goog.dom.TagName.WBR):\\n return false;\\n }\\n return true;\\n};\\n\\n\\n/**\\n * Appends a child to a node.\\n * @param {Node} parent Parent.\\n * @param {Node} child Child.\\n */\\ngoog.dom.appendChild = function(parent, child) {\\n 'use strict';\\n goog.asserts.assert(\\n parent != null && child != null,\\n 'goog.dom.appendChild expects non-null arguments');\\n parent.appendChild(child);\\n};\\n\\n\\n/**\\n * Appends a node with text or other nodes.\\n * @param {!Node} parent The node to append nodes to.\\n * @param {...goog.dom.Appendable} var_args The things to append to the node.\\n * If this is a Node it is appended as is.\\n * If this is a string then a text node is appended.\\n * If this is an array like object then fields 0 to length - 1 are appended.\\n */\\ngoog.dom.append = function(parent, var_args) {\\n 'use strict';\\n goog.dom.append_(goog.dom.getOwnerDocument(parent), parent, arguments, 1);\\n};\\n\\n\\n/**\\n * Removes all the child nodes on a DOM node.\\n * @param {Node} node Node to remove children from.\\n * @return {void}\\n */\\ngoog.dom.removeChildren = function(node) {\\n 'use strict';\\n // Note: Iterations over live collections can be slow, this is the fastest\\n // we could find. The double parenthesis are used to prevent JsCompiler and\\n // strict warnings.\\n var child;\\n while ((child = node.firstChild)) {\\n node.removeChild(child);\\n }\\n};\\n\\n\\n/**\\n * Inserts a new node before an existing reference node (i.e. as the previous\\n * sibling). If the reference node has no parent, then does nothing.\\n * @param {Node} newNode Node to insert.\\n * @param {Node} refNode Reference node to insert before.\\n */\\ngoog.dom.insertSiblingBefore = function(newNode, refNode) {\\n 'use strict';\\n goog.asserts.assert(\\n newNode != null && refNode != null,\\n 'goog.dom.insertSiblingBefore expects non-null arguments');\\n if (refNode.parentNode) {\\n refNode.parentNode.insertBefore(newNode, refNode);\\n }\\n};\\n\\n\\n/**\\n * Inserts a new node after an existing reference node (i.e. as the next\\n * sibling). If the reference node has no parent, then does nothing.\\n * @param {Node} newNode Node to insert.\\n * @param {Node} refNode Reference node to insert after.\\n * @return {void}\\n */\\ngoog.dom.insertSiblingAfter = function(newNode, refNode) {\\n 'use strict';\\n goog.asserts.assert(\\n newNode != null && refNode != null,\\n 'goog.dom.insertSiblingAfter expects non-null arguments');\\n if (refNode.parentNode) {\\n refNode.parentNode.insertBefore(newNode, refNode.nextSibling);\\n }\\n};\\n\\n\\n/**\\n * Insert a child at a given index. If index is larger than the number of child\\n * nodes that the parent currently has, the node is inserted as the last child\\n * node.\\n * @param {Element} parent The element into which to insert the child.\\n * @param {Node} child The element to insert.\\n * @param {number} index The index at which to insert the new child node. Must\\n * not be negative.\\n * @return {void}\\n */\\ngoog.dom.insertChildAt = function(parent, child, index) {\\n 'use strict';\\n // Note that if the second argument is null, insertBefore\\n // will append the child at the end of the list of children.\\n goog.asserts.assert(\\n parent != null, 'goog.dom.insertChildAt expects a non-null parent');\\n parent.insertBefore(\\n /** @type {!Node} */ (child), parent.childNodes[index] || null);\\n};\\n\\n\\n/**\\n * Removes a node from its parent.\\n * @param {Node} node The node to remove.\\n * @return {Node} The node removed if removed; else, null.\\n */\\ngoog.dom.removeNode = function(node) {\\n 'use strict';\\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\\n};\\n\\n\\n/**\\n * Replaces a node in the DOM tree. Will do nothing if `oldNode` has no\\n * parent.\\n * @param {Node} newNode Node to insert.\\n * @param {Node} oldNode Node to replace.\\n */\\ngoog.dom.replaceNode = function(newNode, oldNode) {\\n 'use strict';\\n goog.asserts.assert(\\n newNode != null && oldNode != null,\\n 'goog.dom.replaceNode expects non-null arguments');\\n var parent = oldNode.parentNode;\\n if (parent) {\\n parent.replaceChild(newNode, oldNode);\\n }\\n};\\n\\n\\n/**\\n * Replaces child nodes of `target` with child nodes of `source`. This is\\n * roughly equivalent to `target.innerHTML = source.innerHTML` which is not\\n * compatible with Trusted Types.\\n * @param {?Node} target Node to clean and replace its children.\\n * @param {?Node} source Node to get the children from. The nodes will be cloned\\n * so they will stay in source.\\n */\\ngoog.dom.copyContents = function(target, source) {\\n 'use strict';\\n goog.asserts.assert(\\n target != null && source != null,\\n 'goog.dom.copyContents expects non-null arguments');\\n var childNodes = source.cloneNode(/* deep= */ true).childNodes;\\n goog.dom.removeChildren(target);\\n while (childNodes.length) {\\n target.appendChild(childNodes[0]);\\n }\\n};\\n\\n\\n/**\\n * Flattens an element. That is, removes it and replace it with its children.\\n * Does nothing if the element is not in the document.\\n * @param {Element} element The element to flatten.\\n * @return {Element|undefined} The original element, detached from the document\\n * tree, sans children; or undefined, if the element was not in the document\\n * to begin with.\\n */\\ngoog.dom.flattenElement = function(element) {\\n 'use strict';\\n var child, parent = element.parentNode;\\n if (parent && parent.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) {\\n // Use IE DOM method (supported by Opera too) if available\\n if (element.removeNode) {\\n return /** @type {Element} */ (element.removeNode(false));\\n } else {\\n // Move all children of the original node up one level.\\n while ((child = element.firstChild)) {\\n parent.insertBefore(child, element);\\n }\\n\\n // Detach the original element.\\n return /** @type {Element} */ (goog.dom.removeNode(element));\\n }\\n }\\n};\\n\\n\\n/**\\n * Returns an array containing just the element children of the given element.\\n * @param {Element} element The element whose element children we want.\\n * @return {!(Array<!Element>|NodeList<!Element>)} An array or array-like list\\n * of just the element children of the given element.\\n */\\ngoog.dom.getChildren = function(element) {\\n 'use strict';\\n // We check if the children attribute is supported for child elements\\n // since IE8 misuses the attribute by also including comments.\\n if (element.children != undefined) {\\n return element.children;\\n }\\n // Fall back to manually filtering the element's child nodes.\\n return Array.prototype.filter.call(element.childNodes, function(node) {\\n return node.nodeType == goog.dom.NodeType.ELEMENT;\\n });\\n};\\n\\n\\n/**\\n * Returns the first child node that is an element.\\n * @param {Node} node The node to get the first child element of.\\n * @return {Element} The first child node of `node` that is an element.\\n */\\ngoog.dom.getFirstElementChild = function(node) {\\n 'use strict';\\n if (node.firstElementChild !== undefined) {\\n return /** @type {!Element} */ (node).firstElementChild;\\n }\\n return goog.dom.getNextElementNode_(node.firstChild, true);\\n};\\n\\n\\n/**\\n * Returns the last child node that is an element.\\n * @param {Node} node The node to get the last child element of.\\n * @return {Element} The last child node of `node` that is an element.\\n */\\ngoog.dom.getLastElementChild = function(node) {\\n 'use strict';\\n if (node.lastElementChild !== undefined) {\\n return /** @type {!Element} */ (node).lastElementChild;\\n }\\n return goog.dom.getNextElementNode_(node.lastChild, false);\\n};\\n\\n\\n/**\\n * Returns the first next sibling that is an element.\\n * @param {Node} node The node to get the next sibling element of.\\n * @return {Element} The next sibling of `node` that is an element.\\n */\\ngoog.dom.getNextElementSibling = function(node) {\\n 'use strict';\\n if (node.nextElementSibling !== undefined) {\\n return /** @type {!Element} */ (node).nextElementSibling;\\n }\\n return goog.dom.getNextElementNode_(node.nextSibling, true);\\n};\\n\\n\\n/**\\n * Returns the first previous sibling that is an element.\\n * @param {Node} node The node to get the previous sibling element of.\\n * @return {Element} The first previous sibling of `node` that is\\n * an element.\\n */\\ngoog.dom.getPreviousElementSibling = function(node) {\\n 'use strict';\\n if (node.previousElementSibling !== undefined) {\\n return /** @type {!Element} */ (node).previousElementSibling;\\n }\\n return goog.dom.getNextElementNode_(node.previousSibling, false);\\n};\\n\\n\\n/**\\n * Returns the first node that is an element in the specified direction,\\n * starting with `node`.\\n * @param {Node} node The node to get the next element from.\\n * @param {boolean} forward Whether to look forwards or backwards.\\n * @return {Element} The first element.\\n * @private\\n */\\ngoog.dom.getNextElementNode_ = function(node, forward) {\\n 'use strict';\\n while (node && node.nodeType != goog.dom.NodeType.ELEMENT) {\\n node = forward ? node.nextSibling : node.previousSibling;\\n }\\n\\n return /** @type {Element} */ (node);\\n};\\n\\n\\n/**\\n * Returns the next node in source order from the given node.\\n * @param {Node} node The node.\\n * @return {Node} The next node in the DOM tree, or null if this was the last\\n * node.\\n */\\ngoog.dom.getNextNode = function(node) {\\n 'use strict';\\n if (!node) {\\n return null;\\n }\\n\\n if (node.firstChild) {\\n return node.firstChild;\\n }\\n\\n while (node && !node.nextSibling) {\\n node = node.parentNode;\\n }\\n\\n return node ? node.nextSibling : null;\\n};\\n\\n\\n/**\\n * Returns the previous node in source order from the given node.\\n * @param {Node} node The node.\\n * @return {Node} The previous node in the DOM tree, or null if this was the\\n * first node.\\n */\\ngoog.dom.getPreviousNode = function(node) {\\n 'use strict';\\n if (!node) {\\n return null;\\n }\\n\\n if (!node.previousSibling) {\\n return node.parentNode;\\n }\\n\\n node = node.previousSibling;\\n while (node && node.lastChild) {\\n node = node.lastChild;\\n }\\n\\n return node;\\n};\\n\\n\\n/**\\n * Whether the object looks like a DOM node.\\n * @param {?} obj The object being tested for node likeness.\\n * @return {boolean} Whether the object looks like a DOM node.\\n */\\ngoog.dom.isNodeLike = function(obj) {\\n 'use strict';\\n return goog.isObject(obj) && obj.nodeType > 0;\\n};\\n\\n\\n/**\\n * Whether the object looks like an Element.\\n * @param {?} obj The object being tested for Element likeness.\\n * @return {boolean} Whether the object looks like an Element.\\n */\\ngoog.dom.isElement = function(obj) {\\n 'use strict';\\n return goog.isObject(obj) && obj.nodeType == goog.dom.NodeType.ELEMENT;\\n};\\n\\n\\n/**\\n * Returns true if the specified value is a Window object. This includes the\\n * global window for HTML pages, and iframe windows.\\n * @param {?} obj Variable to test.\\n * @return {boolean} Whether the variable is a window.\\n */\\ngoog.dom.isWindow = function(obj) {\\n 'use strict';\\n return goog.isObject(obj) && obj['window'] == obj;\\n};\\n\\n\\n/**\\n * Returns an element's parent, if it's an Element.\\n * @param {Element} element The DOM element.\\n * @return {Element} The parent, or null if not an Element.\\n */\\ngoog.dom.getParentElement = function(element) {\\n 'use strict';\\n var parent;\\n if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY) {\\n parent = element.parentElement;\\n if (parent) {\\n return parent;\\n }\\n }\\n parent = element.parentNode;\\n return goog.dom.isElement(parent) ? /** @type {!Element} */ (parent) : null;\\n};\\n\\n\\n/**\\n * Whether a node contains another node.\\n * @param {?Node|undefined} parent The node that should contain the other node.\\n * @param {?Node|undefined} descendant The node to test presence of.\\n * @return {boolean} Whether the parent node contains the descendant node.\\n */\\ngoog.dom.contains = function(parent, descendant) {\\n 'use strict';\\n if (!parent || !descendant) {\\n return false;\\n }\\n // We use browser specific methods for this if available since it is faster\\n // that way.\\n\\n // IE DOM\\n if (parent.contains && descendant.nodeType == goog.dom.NodeType.ELEMENT) {\\n return parent == descendant || parent.contains(descendant);\\n }\\n\\n // W3C DOM Level 3\\n if (typeof parent.compareDocumentPosition != 'undefined') {\\n return parent == descendant ||\\n Boolean(parent.compareDocumentPosition(descendant) & 16);\\n }\\n\\n // W3C DOM Level 1\\n while (descendant && parent != descendant) {\\n descendant = descendant.parentNode;\\n }\\n return descendant == parent;\\n};\\n\\n\\n/**\\n * Compares the document order of two nodes, returning 0 if they are the same\\n * node, a negative number if node1 is before node2, and a positive number if\\n * node2 is before node1. Note that we compare the order the tags appear in the\\n * document so in the tree <b><i>text</i></b> the B node is considered to be\\n * before the I node.\\n *\\n * @param {Node} node1 The first node to compare.\\n * @param {Node} node2 The second node to compare.\\n * @return {number} 0 if the nodes are the same node, a negative number if node1\\n * is before node2, and a positive number if node2 is before node1.\\n */\\ngoog.dom.compareNodeOrder = function(node1, node2) {\\n 'use strict';\\n // Fall out quickly for equality.\\n if (node1 == node2) {\\n return 0;\\n }\\n\\n // Use compareDocumentPosition where available\\n if (node1.compareDocumentPosition) {\\n // 4 is the bitmask for FOLLOWS.\\n return node1.compareDocumentPosition(node2) & 2 ? 1 : -1;\\n }\\n\\n // Special case for document nodes on IE 7 and 8.\\n if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {\\n if (node1.nodeType == goog.dom.NodeType.DOCUMENT) {\\n return -1;\\n }\\n if (node2.nodeType == goog.dom.NodeType.DOCUMENT) {\\n return 1;\\n }\\n }\\n\\n // Process in IE using sourceIndex - we check to see if the first node has\\n // a source index or if its parent has one.\\n if ('sourceIndex' in node1 ||\\n (node1.parentNode && 'sourceIndex' in node1.parentNode)) {\\n var isElement1 = node1.nodeType == goog.dom.NodeType.ELEMENT;\\n var isElement2 = node2.nodeType == goog.dom.NodeType.ELEMENT;\\n\\n if (isElement1 && isElement2) {\\n return node1.sourceIndex - node2.sourceIndex;\\n } else {\\n var parent1 = node1.parentNode;\\n var parent2 = node2.parentNode;\\n\\n if (parent1 == parent2) {\\n return goog.dom.compareSiblingOrder_(node1, node2);\\n }\\n\\n if (!isElement1 && goog.dom.contains(parent1, node2)) {\\n return -1 * goog.dom.compareParentsDescendantNodeIe_(node1, node2);\\n }\\n\\n\\n if (!isElement2 && goog.dom.contains(parent2, node1)) {\\n return goog.dom.compareParentsDescendantNodeIe_(node2, node1);\\n }\\n\\n return (isElement1 ? node1.sourceIndex : parent1.sourceIndex) -\\n (isElement2 ? node2.sourceIndex : parent2.sourceIndex);\\n }\\n }\\n\\n // For Safari, we compare ranges.\\n var doc = goog.dom.getOwnerDocument(node1);\\n\\n var range1, range2;\\n range1 = doc.createRange();\\n range1.selectNode(node1);\\n range1.collapse(true);\\n\\n range2 = doc.createRange();\\n range2.selectNode(node2);\\n range2.collapse(true);\\n\\n return range1.compareBoundaryPoints(\\n goog.global['Range'].START_TO_END, range2);\\n};\\n\\n\\n/**\\n * Utility function to compare the position of two nodes, when\\n * `textNode`'s parent is an ancestor of `node`. If this entry\\n * condition is not met, this function will attempt to reference a null object.\\n * @param {!Node} textNode The textNode to compare.\\n * @param {Node} node The node to compare.\\n * @return {number} -1 if node is before textNode, +1 otherwise.\\n * @private\\n */\\ngoog.dom.compareParentsDescendantNodeIe_ = function(textNode, node) {\\n 'use strict';\\n var parent = textNode.parentNode;\\n if (parent == node) {\\n // If textNode is a child of node, then node comes first.\\n return -1;\\n }\\n var sibling = node;\\n while (sibling.parentNode != parent) {\\n sibling = sibling.parentNode;\\n }\\n return goog.dom.compareSiblingOrder_(sibling, textNode);\\n};\\n\\n\\n/**\\n * Utility function to compare the position of two nodes known to be non-equal\\n * siblings.\\n * @param {Node} node1 The first node to compare.\\n * @param {!Node} node2 The second node to compare.\\n * @return {number} -1 if node1 is before node2, +1 otherwise.\\n * @private\\n */\\ngoog.dom.compareSiblingOrder_ = function(node1, node2) {\\n 'use strict';\\n var s = node2;\\n while ((s = s.previousSibling)) {\\n if (s == node1) {\\n // We just found node1 before node2.\\n return -1;\\n }\\n }\\n\\n // Since we didn't find it, node1 must be after node2.\\n return 1;\\n};\\n\\n\\n/**\\n * Find the deepest common ancestor of the given nodes.\\n * @param {...Node} var_args The nodes to find a common ancestor of.\\n * @return {Node} The common ancestor of the nodes, or null if there is none.\\n * null will only be returned if two or more of the nodes are from different\\n * documents.\\n */\\ngoog.dom.findCommonAncestor = function(var_args) {\\n 'use strict';\\n var i, count = arguments.length;\\n if (!count) {\\n return null;\\n } else if (count == 1) {\\n return arguments[0];\\n }\\n\\n var paths = [];\\n var minLength = Infinity;\\n for (i = 0; i < count; i++) {\\n // Compute the list of ancestors.\\n var ancestors = [];\\n var node = arguments[i];\\n while (node) {\\n ancestors.unshift(node);\\n node = node.parentNode;\\n }\\n\\n // Save the list for comparison.\\n paths.push(ancestors);\\n minLength = Math.min(minLength, ancestors.length);\\n }\\n var output = null;\\n for (i = 0; i < minLength; i++) {\\n var first = paths[0][i];\\n for (var j = 1; j < count; j++) {\\n if (first != paths[j][i]) {\\n return output;\\n }\\n }\\n output = first;\\n }\\n return output;\\n};\\n\\n\\n/**\\n * Returns whether node is in a document or detached. Throws an error if node\\n * itself is a document. This specifically handles two cases beyond naive use of\\n * builtins: (1) it works correctly in IE, and (2) it works for elements from\\n * different documents/iframes. If neither of these considerations are relevant\\n * then a simple `document.contains(node)` may be used instead.\\n * @param {!Node} node\\n * @return {boolean}\\n */\\ngoog.dom.isInDocument = function(node) {\\n 'use strict';\\n return (node.ownerDocument.compareDocumentPosition(node) & 16) == 16;\\n};\\n\\n\\n/**\\n * Returns the owner document for a node.\\n * @param {Node|Window} node The node to get the document for.\\n * @return {!Document} The document owning the node.\\n */\\ngoog.dom.getOwnerDocument = function(node) {\\n 'use strict';\\n // TODO(nnaze): Update param signature to be non-nullable.\\n goog.asserts.assert(node, 'Node cannot be null or undefined.');\\n return /** @type {!Document} */ (\\n node.nodeType == goog.dom.NodeType.DOCUMENT ?\\n node :\\n node.ownerDocument || node.document);\\n};\\n\\n\\n/**\\n * Cross-browser function for getting the document element of a frame or iframe.\\n * @param {Element} frame Frame element.\\n * @return {!Document} The frame content document.\\n */\\ngoog.dom.getFrameContentDocument = function(frame) {\\n 'use strict';\\n return frame.contentDocument ||\\n /** @type {!HTMLFrameElement} */ (frame).contentWindow.document;\\n};\\n\\n\\n/**\\n * Cross-browser function for getting the window of a frame or iframe.\\n * @param {Element} frame Frame element.\\n * @return {Window} The window associated with the given frame, or null if none\\n * exists.\\n */\\ngoog.dom.getFrameContentWindow = function(frame) {\\n 'use strict';\\n try {\\n return frame.contentWindow ||\\n (frame.contentDocument ? goog.dom.getWindow(frame.contentDocument) :\\n null);\\n } catch (e) {\\n // NOTE(user): In IE8, checking the contentWindow or contentDocument\\n // properties will throw a \\\"Unspecified Error\\\" exception if the iframe is\\n // not inserted in the DOM. If we get this we can be sure that no window\\n // exists, so return null.\\n }\\n return null;\\n};\\n\\n\\n/**\\n * Sets the text content of a node, with cross-browser support.\\n * @param {Node} node The node to change the text content of.\\n * @param {string|number} text The value that should replace the node's content.\\n * @return {void}\\n */\\ngoog.dom.setTextContent = function(node, text) {\\n 'use strict';\\n goog.asserts.assert(\\n node != null,\\n 'goog.dom.setTextContent expects a non-null value for node');\\n\\n if ('textContent' in node) {\\n node.textContent = text;\\n } else if (node.nodeType == goog.dom.NodeType.TEXT) {\\n /** @type {!Text} */ (node).data = String(text);\\n } else if (\\n node.firstChild && node.firstChild.nodeType == goog.dom.NodeType.TEXT) {\\n // If the first child is a text node we just change its data and remove the\\n // rest of the children.\\n while (node.lastChild != node.firstChild) {\\n node.removeChild(goog.asserts.assert(node.lastChild));\\n }\\n /** @type {!Text} */ (node.firstChild).data = String(text);\\n } else {\\n goog.dom.removeChildren(node);\\n var doc = goog.dom.getOwnerDocument(node);\\n node.appendChild(doc.createTextNode(String(text)));\\n }\\n};\\n\\n\\n/**\\n * Gets the outerHTML of a node, which is like innerHTML, except that it\\n * actually contains the HTML of the node itself.\\n * @param {Element} element The element to get the HTML of.\\n * @return {string} The outerHTML of the given element.\\n */\\ngoog.dom.getOuterHtml = function(element) {\\n 'use strict';\\n goog.asserts.assert(\\n element !== null,\\n 'goog.dom.getOuterHtml expects a non-null value for element');\\n // IE, Opera and WebKit all have outerHTML.\\n if ('outerHTML' in element) {\\n return element.outerHTML;\\n } else {\\n var doc = goog.dom.getOwnerDocument(element);\\n var div = goog.dom.createElement_(doc, goog.dom.TagName.DIV);\\n div.appendChild(element.cloneNode(true));\\n return div.innerHTML;\\n }\\n};\\n\\n\\n/**\\n * Finds the first descendant node that matches the filter function, using depth\\n * first search. This function offers the most general purpose way of finding a\\n * matching element.\\n *\\n * Prefer using `querySelector` if the matching criteria can be expressed as a\\n * CSS selector, or `goog.dom.findElement` if you would filter for `nodeType ==\\n * Node.ELEMENT_NODE`.\\n *\\n * @param {Node} root The root of the tree to search.\\n * @param {function(Node) : boolean} p The filter function.\\n * @return {Node|undefined} The found node or undefined if none is found.\\n */\\ngoog.dom.findNode = function(root, p) {\\n 'use strict';\\n var rv = [];\\n var found = goog.dom.findNodes_(root, p, rv, true);\\n return found ? rv[0] : undefined;\\n};\\n\\n\\n/**\\n * Finds all the descendant nodes that match the filter function, using depth\\n * first search. This function offers the most general-purpose way\\n * of finding a set of matching elements.\\n *\\n * Prefer using `querySelectorAll` if the matching criteria can be expressed as\\n * a CSS selector, or `goog.dom.findElements` if you would filter for\\n * `nodeType == Node.ELEMENT_NODE`.\\n *\\n * @param {Node} root The root of the tree to search.\\n * @param {function(Node) : boolean} p The filter function.\\n * @return {!Array<!Node>} The found nodes or an empty array if none are found.\\n */\\ngoog.dom.findNodes = function(root, p) {\\n 'use strict';\\n var rv = [];\\n goog.dom.findNodes_(root, p, rv, false);\\n return rv;\\n};\\n\\n\\n/**\\n * Finds the first or all the descendant nodes that match the filter function,\\n * using a depth first search.\\n * @param {Node} root The root of the tree to search.\\n * @param {function(Node) : boolean} p The filter function.\\n * @param {!Array<!Node>} rv The found nodes are added to this array.\\n * @param {boolean} findOne If true we exit after the first found node.\\n * @return {boolean} Whether the search is complete or not. True in case findOne\\n * is true and the node is found. False otherwise.\\n * @private\\n */\\ngoog.dom.findNodes_ = function(root, p, rv, findOne) {\\n 'use strict';\\n if (root != null) {\\n var child = root.firstChild;\\n while (child) {\\n if (p(child)) {\\n rv.push(child);\\n if (findOne) {\\n return true;\\n }\\n }\\n if (goog.dom.findNodes_(child, p, rv, findOne)) {\\n return true;\\n }\\n child = child.nextSibling;\\n }\\n }\\n return false;\\n};\\n\\n\\n/**\\n * Finds the first descendant element (excluding `root`) that matches the filter\\n * function, using depth first search. Prefer using `querySelector` if the\\n * matching criteria can be expressed as a CSS selector.\\n *\\n * @param {!Element | !Document} root\\n * @param {function(!Element): boolean} pred Filter function.\\n * @return {?Element} First matching element or null if there is none.\\n */\\ngoog.dom.findElement = function(root, pred) {\\n 'use strict';\\n var stack = goog.dom.getChildrenReverse_(root);\\n while (stack.length > 0) {\\n var next = stack.pop();\\n if (pred(next)) return next;\\n for (var c = next.lastElementChild; c; c = c.previousElementSibling) {\\n stack.push(c);\\n }\\n }\\n return null;\\n};\\n\\n\\n/**\\n * Finds all the descendant elements (excluding `root`) that match the filter\\n * function, using depth first search. Prefer using `querySelectorAll` if the\\n * matching criteria can be expressed as a CSS selector.\\n *\\n * @param {!Element | !Document} root\\n * @param {function(!Element): boolean} pred Filter function.\\n * @return {!Array<!Element>}\\n */\\ngoog.dom.findElements = function(root, pred) {\\n 'use strict';\\n var result = [], stack = goog.dom.getChildrenReverse_(root);\\n while (stack.length > 0) {\\n var next = stack.pop();\\n if (pred(next)) result.push(next);\\n for (var c = next.lastElementChild; c; c = c.previousElementSibling) {\\n stack.push(c);\\n }\\n }\\n return result;\\n};\\n\\n\\n/**\\n * @param {!Element | !Document} node\\n * @return {!Array<!Element>} node's child elements in reverse order.\\n * @private\\n */\\ngoog.dom.getChildrenReverse_ = function(node) {\\n 'use strict';\\n // document.lastElementChild doesn't exist in IE9; fall back to\\n // documentElement.\\n if (node.nodeType == goog.dom.NodeType.DOCUMENT) {\\n return [node.documentElement];\\n } else {\\n var children = [];\\n for (var c = node.lastElementChild; c; c = c.previousElementSibling) {\\n children.push(c);\\n }\\n return children;\\n }\\n};\\n\\n\\n/**\\n * Map of tags whose content to ignore when calculating text length.\\n * @private {!Object<string, number>}\\n * @const\\n */\\ngoog.dom.TAGS_TO_IGNORE_ = {\\n 'SCRIPT': 1,\\n 'STYLE': 1,\\n 'HEAD': 1,\\n 'IFRAME': 1,\\n 'OBJECT': 1\\n};\\n\\n\\n/**\\n * Map of tags which have predefined values with regard to whitespace.\\n * @private {!Object<string, string>}\\n * @const\\n */\\ngoog.dom.PREDEFINED_TAG_VALUES_ = {\\n 'IMG': ' ',\\n 'BR': '\\\\n'\\n};\\n\\n\\n/**\\n * Returns true if the element has a tab index that allows it to receive\\n * keyboard focus (tabIndex >= 0), false otherwise. Note that some elements\\n * natively support keyboard focus, even if they have no tab index.\\n * @param {!Element} element Element to check.\\n * @return {boolean} Whether the element has a tab index that allows keyboard\\n * focus.\\n */\\ngoog.dom.isFocusableTabIndex = function(element) {\\n 'use strict';\\n return goog.dom.hasSpecifiedTabIndex_(element) &&\\n goog.dom.isTabIndexFocusable_(element);\\n};\\n\\n\\n/**\\n * Enables or disables keyboard focus support on the element via its tab index.\\n * Only elements for which {@link goog.dom.isFocusableTabIndex} returns true\\n * (or elements that natively support keyboard focus, like form elements) can\\n * receive keyboard focus. See http://go/tabindex for more info.\\n * @param {Element} element Element whose tab index is to be changed.\\n * @param {boolean} enable Whether to set or remove a tab index on the element\\n * that supports keyboard focus.\\n * @return {void}\\n */\\ngoog.dom.setFocusableTabIndex = function(element, enable) {\\n 'use strict';\\n if (enable) {\\n element.tabIndex = 0;\\n } else {\\n // Set tabIndex to -1 first, then remove it. This is a workaround for\\n // Safari (confirmed in version 4 on Windows). When removing the attribute\\n // without setting it to -1 first, the element remains keyboard focusable\\n // despite not having a tabIndex attribute anymore.\\n element.tabIndex = -1;\\n element.removeAttribute('tabIndex'); // Must be camelCase!\\n }\\n};\\n\\n\\n/**\\n * Returns true if the element can be focused, i.e. it has a tab index that\\n * allows it to receive keyboard focus (tabIndex >= 0), or it is an element\\n * that natively supports keyboard focus.\\n * @param {!Element} element Element to check.\\n * @return {boolean} Whether the element allows keyboard focus.\\n */\\ngoog.dom.isFocusable = function(element) {\\n 'use strict';\\n var focusable;\\n // Some elements can have unspecified tab index and still receive focus.\\n if (goog.dom.nativelySupportsFocus_(element)) {\\n // Make sure the element is not disabled ...\\n focusable = !element.disabled &&\\n // ... and if a tab index is specified, it allows focus.\\n (!goog.dom.hasSpecifiedTabIndex_(element) ||\\n goog.dom.isTabIndexFocusable_(element));\\n } else {\\n focusable = goog.dom.isFocusableTabIndex(element);\\n }\\n\\n // IE requires elements to be visible in order to focus them.\\n return focusable && goog.userAgent.IE ?\\n goog.dom.hasNonZeroBoundingRect_(/** @type {!HTMLElement} */ (element)) :\\n focusable;\\n};\\n\\n\\n/**\\n * Returns true if the element has a specified tab index.\\n * @param {!Element} element Element to check.\\n * @return {boolean} Whether the element has a specified tab index.\\n * @private\\n */\\ngoog.dom.hasSpecifiedTabIndex_ = function(element) {\\n 'use strict';\\n return element.hasAttribute('tabindex');\\n};\\n\\n\\n/**\\n * Returns true if the element's tab index allows the element to be focused.\\n * @param {!Element} element Element to check.\\n * @return {boolean} Whether the element's tab index allows focus.\\n * @private\\n */\\ngoog.dom.isTabIndexFocusable_ = function(element) {\\n 'use strict';\\n var index = /** @type {!HTMLElement} */ (element).tabIndex;\\n // NOTE: IE9 puts tabIndex in 16-bit int, e.g. -2 is 65534.\\n return typeof (index) === 'number' && index >= 0 && index < 32768;\\n};\\n\\n\\n/**\\n * Returns true if the element is focusable even when tabIndex is not set.\\n * @param {!Element} element Element to check.\\n * @return {boolean} Whether the element natively supports focus.\\n * @private\\n */\\ngoog.dom.nativelySupportsFocus_ = function(element) {\\n 'use strict';\\n return (\\n element.tagName == goog.dom.TagName.A && element.hasAttribute('href') ||\\n element.tagName == goog.dom.TagName.INPUT ||\\n element.tagName == goog.dom.TagName.TEXTAREA ||\\n element.tagName == goog.dom.TagName.SELECT ||\\n element.tagName == goog.dom.TagName.BUTTON);\\n};\\n\\n\\n/**\\n * Returns true if the element has a bounding rectangle that would be visible\\n * (i.e. its width and height are greater than zero).\\n * @param {!HTMLElement} element Element to check.\\n * @return {boolean} Whether the element has a non-zero bounding rectangle.\\n * @private\\n */\\ngoog.dom.hasNonZeroBoundingRect_ = function(element) {\\n 'use strict';\\n var rect;\\n if (typeof element['getBoundingClientRect'] !== 'function' ||\\n // In IE, getBoundingClientRect throws on detached nodes.\\n (goog.userAgent.IE && element.parentElement == null)) {\\n rect = {'height': element.offsetHeight, 'width': element.offsetWidth};\\n } else {\\n rect = element.getBoundingClientRect();\\n }\\n return rect != null && rect.height > 0 && rect.width > 0;\\n};\\n\\n\\n/**\\n * Returns the text content of the current node, without markup and invisible\\n * symbols. New lines are stripped and whitespace is collapsed,\\n * such that each character would be visible.\\n *\\n * In browsers that support it, innerText is used. Other browsers attempt to\\n * simulate it via node traversal. Line breaks are canonicalized in IE.\\n *\\n * @param {Node} node The node from which we are getting content.\\n * @return {string} The text content.\\n */\\ngoog.dom.getTextContent = function(node) {\\n 'use strict';\\n var textContent;\\n var buf = [];\\n goog.dom.getTextContent_(node, buf, true);\\n textContent = buf.join('');\\n\\n // Strip &shy; entities. goog.format.insertWordBreaks inserts them in Opera.\\n textContent = textContent.replace(/ \\\\xAD /g, ' ').replace(/\\\\xAD/g, '');\\n // Strip &#8203; entities. goog.format.insertWordBreaks inserts them in IE8.\\n textContent = textContent.replace(/\\\\u200B/g, '');\\n\\n textContent = textContent.replace(/ +/g, ' ');\\n if (textContent != ' ') {\\n textContent = textContent.replace(/^\\\\s*/, '');\\n }\\n\\n return textContent;\\n};\\n\\n\\n/**\\n * Returns the text content of the current node, without markup.\\n *\\n * Unlike `getTextContent` this method does not collapse whitespaces\\n * or normalize lines breaks.\\n *\\n * @param {Node} node The node from which we are getting content.\\n * @return {string} The raw text content.\\n */\\ngoog.dom.getRawTextContent = function(node) {\\n 'use strict';\\n var buf = [];\\n goog.dom.getTextContent_(node, buf, false);\\n\\n return buf.join('');\\n};\\n\\n\\n/**\\n * Recursive support function for text content retrieval.\\n *\\n * @param {Node} node The node from which we are getting content.\\n * @param {Array<string>} buf string buffer.\\n * @param {boolean} normalizeWhitespace Whether to normalize whitespace.\\n * @private\\n */\\ngoog.dom.getTextContent_ = function(node, buf, normalizeWhitespace) {\\n 'use strict';\\n if (node.nodeName in goog.dom.TAGS_TO_IGNORE_) {\\n // ignore certain tags\\n } else if (node.nodeType == goog.dom.NodeType.TEXT) {\\n if (normalizeWhitespace) {\\n buf.push(String(node.nodeValue).replace(/(\\\\r\\\\n|\\\\r|\\\\n)/g, ''));\\n } else {\\n buf.push(node.nodeValue);\\n }\\n } else if (node.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {\\n buf.push(goog.dom.PREDEFINED_TAG_VALUES_[node.nodeName]);\\n } else {\\n var child = node.firstChild;\\n while (child) {\\n goog.dom.getTextContent_(child, buf, normalizeWhitespace);\\n child = child.nextSibling;\\n }\\n }\\n};\\n\\n\\n/**\\n * Returns the text length of the text contained in a node, without markup. This\\n * is equivalent to the selection length if the node was selected, or the number\\n * of cursor movements to traverse the node. Images & BRs take one space. New\\n * lines are ignored.\\n *\\n * @param {Node} node The node whose text content length is being calculated.\\n * @return {number} The length of `node`'s text content.\\n */\\ngoog.dom.getNodeTextLength = function(node) {\\n 'use strict';\\n return goog.dom.getTextContent(node).length;\\n};\\n\\n\\n/**\\n * Returns the text offset of a node relative to one of its ancestors. The text\\n * length is the same as the length calculated by goog.dom.getNodeTextLength.\\n *\\n * @param {Node} node The node whose offset is being calculated.\\n * @param {Node=} opt_offsetParent The node relative to which the offset will\\n * be calculated. Defaults to the node's owner document's body.\\n * @return {number} The text offset.\\n */\\ngoog.dom.getNodeTextOffset = function(node, opt_offsetParent) {\\n 'use strict';\\n var root = opt_offsetParent || goog.dom.getOwnerDocument(node).body;\\n var buf = [];\\n while (node && node != root) {\\n var cur = node;\\n while ((cur = cur.previousSibling)) {\\n buf.unshift(goog.dom.getTextContent(cur));\\n }\\n node = node.parentNode;\\n }\\n // Trim left to deal with FF cases when there might be line breaks and empty\\n // nodes at the front of the text\\n return goog.string.trimLeft(buf.join('')).replace(/ +/g, ' ').length;\\n};\\n\\n\\n/**\\n * Returns the node at a given offset in a parent node. If an object is\\n * provided for the optional third parameter, the node and the remainder of the\\n * offset will stored as properties of this object.\\n * @param {Node} parent The parent node.\\n * @param {number} offset The offset into the parent node.\\n * @param {Object=} opt_result Object to be used to store the return value. The\\n * return value will be stored in the form {node: Node, remainder: number}\\n * if this object is provided.\\n * @return {Node} The node at the given offset.\\n */\\ngoog.dom.getNodeAtOffset = function(parent, offset, opt_result) {\\n 'use strict';\\n var stack = [parent], pos = 0, cur = null;\\n while (stack.length > 0 && pos < offset) {\\n cur = stack.pop();\\n if (cur.nodeName in goog.dom.TAGS_TO_IGNORE_) {\\n // ignore certain tags\\n } else if (cur.nodeType == goog.dom.NodeType.TEXT) {\\n var text = cur.nodeValue.replace(/(\\\\r\\\\n|\\\\r|\\\\n)/g, '').replace(/ +/g, ' ');\\n pos += text.length;\\n } else if (cur.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {\\n pos += goog.dom.PREDEFINED_TAG_VALUES_[cur.nodeName].length;\\n } else {\\n for (var i = cur.childNodes.length - 1; i >= 0; i--) {\\n stack.push(cur.childNodes[i]);\\n }\\n }\\n }\\n if (goog.isObject(opt_result)) {\\n opt_result.remainder = cur ? cur.nodeValue.length + offset - pos - 1 : 0;\\n opt_result.node = cur;\\n }\\n\\n return cur;\\n};\\n\\n\\n/**\\n * Returns true if the object is a `NodeList`. To qualify as a NodeList,\\n * the object must have a numeric length property and an item function (which\\n * has type 'string' on IE for some reason).\\n * @param {Object} val Object to test.\\n * @return {boolean} Whether the object is a NodeList.\\n */\\ngoog.dom.isNodeList = function(val) {\\n 'use strict';\\n // TODO(attila): Now the isNodeList is part of goog.dom we can use\\n // goog.userAgent to make this simpler.\\n // A NodeList must have a length property of type 'number' on all platforms.\\n if (val && typeof val.length == 'number') {\\n // A NodeList is an object everywhere except Safari, where it's a function.\\n if (goog.isObject(val)) {\\n // A NodeList must have an item function (on non-IE platforms) or an item\\n // property of type 'string' (on IE).\\n return typeof val.item == 'function' || typeof val.item == 'string';\\n } else if (typeof val === 'function') {\\n // On Safari, a NodeList is a function with an item property that is also\\n // a function.\\n return typeof /** @type {?} */ (val.item) == 'function';\\n }\\n }\\n\\n // Not a NodeList.\\n return false;\\n};\\n\\n\\n/**\\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\\n * tag name and/or class name. If the passed element matches the specified\\n * criteria, the element itself is returned.\\n * @param {Node} element The DOM node to start with.\\n * @param {?(goog.dom.TagName<T>|string)=} opt_tag The tag name to match (or\\n * null/undefined to match only based on class name).\\n * @param {?string=} opt_class The class name to match (or null/undefined to\\n * match only based on tag name).\\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\\n * dom.\\n * @return {?R} The first ancestor that matches the passed criteria, or\\n * null if no match is found. The return type is {?Element} if opt_tag is\\n * not a member of goog.dom.TagName or a more specific type if it is (e.g.\\n * {?HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.getAncestorByTagNameAndClass = function(\\n element, opt_tag, opt_class, opt_maxSearchSteps) {\\n 'use strict';\\n if (!opt_tag && !opt_class) {\\n return null;\\n }\\n var tagName = opt_tag ? String(opt_tag).toUpperCase() : null;\\n return /** @type {Element} */ (goog.dom.getAncestor(element, function(node) {\\n 'use strict';\\n return (!tagName || node.nodeName == tagName) &&\\n (!opt_class ||\\n typeof node.className === 'string' &&\\n goog.array.contains(node.className.split(/\\\\s+/), opt_class));\\n }, true, opt_maxSearchSteps));\\n};\\n\\n\\n/**\\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\\n * class name. If the passed element matches the specified criteria, the\\n * element itself is returned.\\n * @param {Node} element The DOM node to start with.\\n * @param {string} className The class name to match.\\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\\n * dom.\\n * @return {Element} The first ancestor that matches the passed criteria, or\\n * null if none match.\\n */\\ngoog.dom.getAncestorByClass = function(element, className, opt_maxSearchSteps) {\\n 'use strict';\\n return goog.dom.getAncestorByTagNameAndClass(\\n element, null, className, opt_maxSearchSteps);\\n};\\n\\n\\n/**\\n * Walks up the DOM hierarchy returning the first ancestor that passes the\\n * matcher function.\\n * @param {Node} element The DOM node to start with.\\n * @param {function(!Node) : boolean} matcher A function that returns true if\\n * the passed node matches the desired criteria.\\n * @param {boolean=} opt_includeNode If true, the node itself is included in\\n * the search (the first call to the matcher will pass startElement as\\n * the node to test).\\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\\n * dom.\\n * @return {Node} DOM node that matched the matcher, or null if there was\\n * no match.\\n */\\ngoog.dom.getAncestor = function(\\n element, matcher, opt_includeNode, opt_maxSearchSteps) {\\n 'use strict';\\n if (element && !opt_includeNode) {\\n element = element.parentNode;\\n }\\n var steps = 0;\\n while (element &&\\n (opt_maxSearchSteps == null || steps <= opt_maxSearchSteps)) {\\n goog.asserts.assert(element.name != 'parentNode');\\n if (matcher(element)) {\\n return element;\\n }\\n element = element.parentNode;\\n steps++;\\n }\\n // Reached the root of the DOM without a match\\n return null;\\n};\\n\\n\\n/**\\n * Determines the active element in the given document.\\n * @param {Document} doc The document to look in.\\n * @return {Element} The active element.\\n */\\ngoog.dom.getActiveElement = function(doc) {\\n 'use strict';\\n // While in an iframe, IE9 will throw \\\"Unspecified error\\\" when accessing\\n // activeElement.\\n try {\\n var activeElement = doc && doc.activeElement;\\n // While not in an iframe, IE9-11 sometimes gives null.\\n // While in an iframe, IE11 sometimes returns an empty object.\\n return activeElement && activeElement.nodeName ? activeElement : null;\\n } catch (e) {\\n return null;\\n }\\n};\\n\\n\\n/**\\n * Gives the current devicePixelRatio.\\n *\\n * By default, this is the value of window.devicePixelRatio (which should be\\n * preferred if present).\\n *\\n * If window.devicePixelRatio is not present, the ratio is calculated with\\n * window.matchMedia, if present. Otherwise, gives 1.0.\\n *\\n * Some browsers (including Chrome) consider the browser zoom level in the pixel\\n * ratio, so the value may change across multiple calls.\\n *\\n * @return {number} The number of actual pixels per virtual pixel.\\n */\\ngoog.dom.getPixelRatio = function() {\\n 'use strict';\\n var win = goog.dom.getWindow();\\n if (win.devicePixelRatio !== undefined) {\\n return win.devicePixelRatio;\\n } else if (win.matchMedia) {\\n // Should be for IE10 and FF6-17 (this basically clamps to lower)\\n // Note that the order of these statements is important\\n return goog.dom.matchesPixelRatio_(3) || goog.dom.matchesPixelRatio_(2) ||\\n goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(1) ||\\n .75;\\n }\\n return 1;\\n};\\n\\n\\n/**\\n * Calculates a mediaQuery to check if the current device supports the\\n * given actual to virtual pixel ratio.\\n * @param {number} pixelRatio The ratio of actual pixels to virtual pixels.\\n * @return {number} pixelRatio if applicable, otherwise 0.\\n * @private\\n */\\ngoog.dom.matchesPixelRatio_ = function(pixelRatio) {\\n 'use strict';\\n var win = goog.dom.getWindow();\\n /**\\n * Due to the 1:96 fixed ratio of CSS in to CSS px, 1dppx is equivalent to\\n * 96dpi.\\n * @const {number}\\n */\\n var dpiPerDppx = 96;\\n var query =\\n // FF16-17\\n '(min-resolution: ' + pixelRatio + 'dppx),' +\\n // FF6-15\\n '(min--moz-device-pixel-ratio: ' + pixelRatio + '),' +\\n // IE10 (this works for the two browsers above too but I don't want to\\n // trust the 1:96 fixed ratio magic)\\n '(min-resolution: ' + (pixelRatio * dpiPerDppx) + 'dpi)';\\n return win.matchMedia(query).matches ? pixelRatio : 0;\\n};\\n\\n\\n/**\\n * Gets '2d' context of a canvas. Shortcut for canvas.getContext('2d') with a\\n * type information.\\n * @param {!HTMLCanvasElement|!OffscreenCanvas} canvas\\n * @return {!CanvasRenderingContext2D}\\n */\\ngoog.dom.getCanvasContext2D = function(canvas) {\\n 'use strict';\\n return /** @type {!CanvasRenderingContext2D} */ (canvas.getContext('2d'));\\n};\\n\\n\\n\\n/**\\n * Create an instance of a DOM helper with a new document object.\\n * @param {Document=} opt_document Document object to associate with this\\n * DOM helper.\\n * @constructor\\n */\\ngoog.dom.DomHelper = function(opt_document) {\\n 'use strict';\\n /**\\n * Reference to the document object to use\\n * @type {!Document}\\n * @private\\n */\\n this.document_ = opt_document || goog.global.document || document;\\n};\\n\\n\\n/**\\n * Gets the dom helper object for the document where the element resides.\\n * @param {Node=} opt_node If present, gets the DomHelper for this node.\\n * @return {!goog.dom.DomHelper} The DomHelper.\\n */\\ngoog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper;\\n\\n\\n/**\\n * Sets the document object.\\n * @param {!Document} document Document object.\\n */\\ngoog.dom.DomHelper.prototype.setDocument = function(document) {\\n 'use strict';\\n this.document_ = document;\\n};\\n\\n\\n/**\\n * Gets the document object being used by the dom library.\\n * @return {!Document} Document object.\\n */\\ngoog.dom.DomHelper.prototype.getDocument = function() {\\n 'use strict';\\n return this.document_;\\n};\\n\\n\\n/**\\n * Alias for `getElementById`. If a DOM node is passed in then we just\\n * return that.\\n * @param {string|Element} element Element ID or a DOM node.\\n * @return {Element} The element with the given ID, or the node passed in.\\n */\\ngoog.dom.DomHelper.prototype.getElement = function(element) {\\n 'use strict';\\n return goog.dom.getElementHelper_(this.document_, element);\\n};\\n\\n\\n/**\\n * Gets an element by id, asserting that the element is found.\\n *\\n * This is used when an element is expected to exist, and should fail with\\n * an assertion error if it does not (if assertions are enabled).\\n *\\n * @param {string} id Element ID.\\n * @return {!Element} The element with the given ID, if it exists.\\n */\\ngoog.dom.DomHelper.prototype.getRequiredElement = function(id) {\\n 'use strict';\\n return goog.dom.getRequiredElementHelper_(this.document_, id);\\n};\\n\\n\\n/**\\n * Alias for `getElement`.\\n * @param {string|Element} element Element ID or a DOM node.\\n * @return {Element} The element with the given ID, or the node passed in.\\n * @deprecated Use {@link goog.dom.DomHelper.prototype.getElement} instead.\\n */\\ngoog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;\\n\\n\\n/**\\n * Gets elements by tag name.\\n * @param {!goog.dom.TagName<T>} tagName\\n * @param {(!Document|!Element)=} opt_parent Parent element or document where to\\n * look for elements. Defaults to document of this DomHelper.\\n * @return {!NodeList<R>} List of elements. The members of the list are\\n * {!Element} if tagName is not a member of goog.dom.TagName or more\\n * specific types if it is (e.g. {!HTMLAnchorElement} for\\n * goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.DomHelper.prototype.getElementsByTagName = function(\\n tagName, opt_parent) {\\n 'use strict';\\n var parent = opt_parent || this.document_;\\n return parent.getElementsByTagName(String(tagName));\\n};\\n\\n\\n/**\\n * Looks up elements by both tag and class name, using browser native functions\\n * (`querySelectorAll`, `getElementsByTagName` or\\n * `getElementsByClassName`) where possible. The returned array is a live\\n * NodeList or a static list depending on the code path taken.\\n *\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name or * for all\\n * tags.\\n * @param {?string=} opt_class Optional class name.\\n * @param {(Document|Element)=} opt_el Optional element to look in.\\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\\n * and numerical indices are guaranteed to exist). The members of the array\\n * are {!Element} if opt_tag is not a member of goog.dom.TagName or more\\n * specific types if it is (e.g. {!HTMLAnchorElement} for\\n * goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(\\n opt_tag, opt_class, opt_el) {\\n 'use strict';\\n return goog.dom.getElementsByTagNameAndClass_(\\n this.document_, opt_tag, opt_class, opt_el);\\n};\\n\\n\\n/**\\n * Gets the first element matching the tag and the class.\\n *\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\\n * @param {?string=} opt_class Optional class name.\\n * @param {(Document|Element)=} opt_el Optional element to look in.\\n * @return {?R} Reference to a DOM node. The return type is {?Element} if\\n * tagName is a string or a more specific type if it is a member of\\n * goog.dom.TagName (e.g. {?HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.DomHelper.prototype.getElementByTagNameAndClass = function(\\n opt_tag, opt_class, opt_el) {\\n 'use strict';\\n return goog.dom.getElementByTagNameAndClass_(\\n this.document_, opt_tag, opt_class, opt_el);\\n};\\n\\n\\n/**\\n * Returns an array of all the elements with the provided className.\\n * @param {string} className the name of the class to look for.\\n * @param {Element|Document=} opt_el Optional element to look in.\\n * @return {!IArrayLike<!Element>} The items found with the class name provided.\\n */\\ngoog.dom.DomHelper.prototype.getElementsByClass = function(className, opt_el) {\\n 'use strict';\\n var doc = opt_el || this.document_;\\n return goog.dom.getElementsByClass(className, doc);\\n};\\n\\n\\n/**\\n * Returns the first element we find matching the provided class name.\\n * @param {string} className the name of the class to look for.\\n * @param {(Element|Document)=} opt_el Optional element to look in.\\n * @return {Element} The first item found with the class name provided.\\n */\\ngoog.dom.DomHelper.prototype.getElementByClass = function(className, opt_el) {\\n 'use strict';\\n var doc = opt_el || this.document_;\\n return goog.dom.getElementByClass(className, doc);\\n};\\n\\n\\n/**\\n * Ensures an element with the given className exists, and then returns the\\n * first element with the provided className.\\n * @param {string} className the name of the class to look for.\\n * @param {(!Element|!Document)=} opt_root Optional element or document to look\\n * in.\\n * @return {!Element} The first item found with the class name provided.\\n * @throws {goog.asserts.AssertionError} Thrown if no element is found.\\n */\\ngoog.dom.DomHelper.prototype.getRequiredElementByClass = function(\\n className, opt_root) {\\n 'use strict';\\n var root = opt_root || this.document_;\\n return goog.dom.getRequiredElementByClass(className, root);\\n};\\n\\n\\n/**\\n * Alias for `getElementsByTagNameAndClass`.\\n * @deprecated Use DomHelper getElementsByTagNameAndClass.\\n *\\n * @param {(string|?goog.dom.TagName<T>)=} opt_tag Element tag name.\\n * @param {?string=} opt_class Optional class name.\\n * @param {Element=} opt_el Optional element to look in.\\n * @return {!IArrayLike<R>} Array-like list of elements (only a length property\\n * and numerical indices are guaranteed to exist). The members of the array\\n * are {!Element} if opt_tag is a string or more specific types if it is\\n * a member of goog.dom.TagName (e.g. {!HTMLAnchorElement} for\\n * goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.DomHelper.prototype.$$ =\\n goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;\\n\\n\\n/**\\n * Sets a number of properties on a node.\\n * @param {Element} element DOM node to set properties on.\\n * @param {Object} properties Hash of property:value pairs.\\n */\\ngoog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties;\\n\\n\\n/**\\n * Gets the dimensions of the viewport.\\n * @param {Window=} opt_window Optional window element to test. Defaults to\\n * the window of the Dom Helper.\\n * @return {!goog.math.Size} Object with values 'width' and 'height'.\\n */\\ngoog.dom.DomHelper.prototype.getViewportSize = function(opt_window) {\\n 'use strict';\\n // TODO(arv): This should not take an argument. That breaks the rule of a\\n // a DomHelper representing a single frame/window/document.\\n return goog.dom.getViewportSize(opt_window || this.getWindow());\\n};\\n\\n\\n/**\\n * Calculates the height of the document.\\n *\\n * @return {number} The height of the document.\\n */\\ngoog.dom.DomHelper.prototype.getDocumentHeight = function() {\\n 'use strict';\\n return goog.dom.getDocumentHeight_(this.getWindow());\\n};\\n\\n\\n/**\\n * Typedef for use with goog.dom.createDom and goog.dom.append.\\n * @typedef {Object|string|Array|NodeList}\\n */\\ngoog.dom.Appendable;\\n\\n\\n/**\\n * Returns a dom node with a set of attributes. This function accepts varargs\\n * for subsequent nodes to be added. Subsequent nodes will be added to the\\n * first node as childNodes.\\n *\\n * So:\\n * <code>createDom(goog.dom.TagName.DIV, null, createDom(goog.dom.TagName.P),\\n * createDom(goog.dom.TagName.P));</code> would return a div with two child\\n * paragraphs\\n *\\n * An easy way to move all child nodes of an existing element to a new parent\\n * element is:\\n * <code>createDom(goog.dom.TagName.DIV, null, oldElement.childNodes);</code>\\n * which will remove all child nodes from the old element and add them as\\n * child nodes of the new DIV.\\n *\\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\\n * of name-value pairs for attributes. If a string, then this is the\\n * className of the new element. If an array, the elements will be joined\\n * together as the className of the new element.\\n * @param {...(goog.dom.Appendable|undefined)} var_args Further DOM nodes or\\n * strings for text nodes. If one of the var_args is an array or\\n * NodeList, its elements will be added as childNodes instead.\\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\\n * is a string or a more specific type if it is a member of\\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.DomHelper.prototype.createDom = function(\\n tagName, opt_attributes, var_args) {\\n 'use strict';\\n return goog.dom.createDom_(this.document_, arguments);\\n};\\n\\n\\n/**\\n * Alias for `createDom`.\\n * @param {string|!goog.dom.TagName<T>} tagName Tag to create.\\n * @param {?Object|?Array<string>|string=} opt_attributes If object, then a map\\n * of name-value pairs for attributes. If a string, then this is the\\n * className of the new element. If an array, the elements will be joined\\n * together as the className of the new element.\\n * @param {...(goog.dom.Appendable|undefined)} var_args Further DOM nodes or\\n * strings for text nodes. If one of the var_args is an array, its children\\n * will be added as childNodes instead.\\n * @return {R} Reference to a DOM node. The return type is {!Element} if tagName\\n * is a string or a more specific type if it is a member of\\n * goog.dom.TagName (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n * @deprecated Use {@link goog.dom.DomHelper.prototype.createDom} instead.\\n */\\ngoog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;\\n\\n\\n/**\\n * Creates a new element.\\n * @param {string|!goog.dom.TagName<T>} name Tag to create.\\n * @return {R} The new element. The return type is {!Element} if name is\\n * a string or a more specific type if it is a member of goog.dom.TagName\\n * (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.DomHelper.prototype.createElement = function(name) {\\n 'use strict';\\n return goog.dom.createElement_(this.document_, name);\\n};\\n\\n\\n/**\\n * Creates a new text node.\\n * @param {number|string} content Content.\\n * @return {!Text} The new text node.\\n */\\ngoog.dom.DomHelper.prototype.createTextNode = function(content) {\\n 'use strict';\\n return this.document_.createTextNode(String(content));\\n};\\n\\n\\n/**\\n * Create a table.\\n * @param {number} rows The number of rows in the table. Must be >= 1.\\n * @param {number} columns The number of columns in the table. Must be >= 1.\\n * @param {boolean=} opt_fillWithNbsp If true, fills table entries with\\n * `goog.string.Unicode.NBSP` characters.\\n * @return {!HTMLElement} The created table.\\n */\\ngoog.dom.DomHelper.prototype.createTable = function(\\n rows, columns, opt_fillWithNbsp) {\\n 'use strict';\\n return goog.dom.createTable_(\\n this.document_, rows, columns, !!opt_fillWithNbsp);\\n};\\n\\n\\n/**\\n * Converts an HTML into a node or a document fragment. A single Node is used if\\n * `html` only generates a single node. If `html` generates multiple\\n * nodes then these are put inside a `DocumentFragment`. This is a safe\\n * version of `goog.dom.DomHelper#htmlToDocumentFragment` which is now\\n * deleted.\\n * @param {!goog.html.SafeHtml} html The HTML markup to convert.\\n * @return {!Node} The resulting node.\\n */\\ngoog.dom.DomHelper.prototype.safeHtmlToNode = function(html) {\\n 'use strict';\\n return goog.dom.safeHtmlToNode_(this.document_, html);\\n};\\n\\n\\n/**\\n * Returns true if the browser is in \\\"CSS1-compatible\\\" (standards-compliant)\\n * mode, false otherwise.\\n * @return {boolean} True if in CSS1-compatible mode.\\n */\\ngoog.dom.DomHelper.prototype.isCss1CompatMode = function() {\\n 'use strict';\\n return goog.dom.isCss1CompatMode_(this.document_);\\n};\\n\\n\\n/**\\n * Gets the window object associated with the document.\\n * @return {!Window} The window associated with the given document.\\n */\\ngoog.dom.DomHelper.prototype.getWindow = function() {\\n 'use strict';\\n return goog.dom.getWindow_(this.document_);\\n};\\n\\n\\n/**\\n * Gets the document scroll element.\\n * @return {!Element} Scrolling element.\\n */\\ngoog.dom.DomHelper.prototype.getDocumentScrollElement = function() {\\n 'use strict';\\n return goog.dom.getDocumentScrollElement_(this.document_);\\n};\\n\\n\\n/**\\n * Gets the document scroll distance as a coordinate object.\\n * @return {!goog.math.Coordinate} Object with properties 'x' and 'y'.\\n */\\ngoog.dom.DomHelper.prototype.getDocumentScroll = function() {\\n 'use strict';\\n return goog.dom.getDocumentScroll_(this.document_);\\n};\\n\\n\\n/**\\n * Determines the active element in the given document.\\n * @param {Document=} opt_doc The document to look in.\\n * @return {Element} The active element.\\n */\\ngoog.dom.DomHelper.prototype.getActiveElement = function(opt_doc) {\\n 'use strict';\\n return goog.dom.getActiveElement(opt_doc || this.document_);\\n};\\n\\n\\n/**\\n * Appends a child to a node.\\n * @param {Node} parent Parent.\\n * @param {Node} child Child.\\n */\\ngoog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild;\\n\\n\\n/**\\n * Appends a node with text or other nodes.\\n * @param {!Node} parent The node to append nodes to.\\n * @param {...goog.dom.Appendable} var_args The things to append to the node.\\n * If this is a Node it is appended as is.\\n * If this is a string then a text node is appended.\\n * If this is an array like object then fields 0 to length - 1 are appended.\\n */\\ngoog.dom.DomHelper.prototype.append = goog.dom.append;\\n\\n\\n/**\\n * Determines if the given node can contain children, intended to be used for\\n * HTML generation.\\n *\\n * @param {Node} node The node to check.\\n * @return {boolean} Whether the node can contain children.\\n */\\ngoog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren;\\n\\n\\n/**\\n * Removes all the child nodes on a DOM node.\\n * @param {Node} node Node to remove children from.\\n */\\ngoog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren;\\n\\n\\n/**\\n * Inserts a new node before an existing reference node (i.e., as the previous\\n * sibling). If the reference node has no parent, then does nothing.\\n * @param {Node} newNode Node to insert.\\n * @param {Node} refNode Reference node to insert before.\\n */\\ngoog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore;\\n\\n\\n/**\\n * Inserts a new node after an existing reference node (i.e., as the next\\n * sibling). If the reference node has no parent, then does nothing.\\n * @param {Node} newNode Node to insert.\\n * @param {Node} refNode Reference node to insert after.\\n */\\ngoog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter;\\n\\n\\n/**\\n * Insert a child at a given index. If index is larger than the number of child\\n * nodes that the parent currently has, the node is inserted as the last child\\n * node.\\n * @param {Element} parent The element into which to insert the child.\\n * @param {Node} child The element to insert.\\n * @param {number} index The index at which to insert the new child node. Must\\n * not be negative.\\n */\\ngoog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt;\\n\\n\\n/**\\n * Removes a node from its parent.\\n * @param {Node} node The node to remove.\\n * @return {Node} The node removed if removed; else, null.\\n */\\ngoog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode;\\n\\n\\n/**\\n * Replaces a node in the DOM tree. Will do nothing if `oldNode` has no\\n * parent.\\n * @param {Node} newNode Node to insert.\\n * @param {Node} oldNode Node to replace.\\n */\\ngoog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode;\\n\\n\\n/**\\n * Replaces child nodes of `target` with child nodes of `source`. This is\\n * roughly equivalent to `target.innerHTML = source.innerHTML` which is not\\n * compatible with Trusted Types.\\n * @param {?Node} target Node to clean and replace its children.\\n * @param {?Node} source Node to get the children from. The nodes will be cloned\\n * so they will stay in source.\\n */\\ngoog.dom.DomHelper.prototype.copyContents = goog.dom.copyContents;\\n\\n\\n/**\\n * Flattens an element. That is, removes it and replace it with its children.\\n * @param {Element} element The element to flatten.\\n * @return {Element|undefined} The original element, detached from the document\\n * tree, sans children, or undefined if the element was already not in the\\n * document.\\n */\\ngoog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement;\\n\\n\\n/**\\n * Returns an array containing just the element children of the given element.\\n * @param {Element} element The element whose element children we want.\\n * @return {!(Array<!Element>|NodeList<!Element>)} An array or array-like list\\n * of just the element children of the given element.\\n */\\ngoog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren;\\n\\n\\n/**\\n * Returns the first child node that is an element.\\n * @param {Node} node The node to get the first child element of.\\n * @return {Element} The first child node of `node` that is an element.\\n */\\ngoog.dom.DomHelper.prototype.getFirstElementChild =\\n goog.dom.getFirstElementChild;\\n\\n\\n/**\\n * Returns the last child node that is an element.\\n * @param {Node} node The node to get the last child element of.\\n * @return {Element} The last child node of `node` that is an element.\\n */\\ngoog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild;\\n\\n\\n/**\\n * Returns the first next sibling that is an element.\\n * @param {Node} node The node to get the next sibling element of.\\n * @return {Element} The next sibling of `node` that is an element.\\n */\\ngoog.dom.DomHelper.prototype.getNextElementSibling =\\n goog.dom.getNextElementSibling;\\n\\n\\n/**\\n * Returns the first previous sibling that is an element.\\n * @param {Node} node The node to get the previous sibling element of.\\n * @return {Element} The first previous sibling of `node` that is\\n * an element.\\n */\\ngoog.dom.DomHelper.prototype.getPreviousElementSibling =\\n goog.dom.getPreviousElementSibling;\\n\\n\\n/**\\n * Returns the next node in source order from the given node.\\n * @param {Node} node The node.\\n * @return {Node} The next node in the DOM tree, or null if this was the last\\n * node.\\n */\\ngoog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode;\\n\\n\\n/**\\n * Returns the previous node in source order from the given node.\\n * @param {Node} node The node.\\n * @return {Node} The previous node in the DOM tree, or null if this was the\\n * first node.\\n */\\ngoog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode;\\n\\n\\n/**\\n * Whether the object looks like a DOM node.\\n * @param {?} obj The object being tested for node likeness.\\n * @return {boolean} Whether the object looks like a DOM node.\\n */\\ngoog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike;\\n\\n\\n/**\\n * Whether the object looks like an Element.\\n * @param {?} obj The object being tested for Element likeness.\\n * @return {boolean} Whether the object looks like an Element.\\n */\\ngoog.dom.DomHelper.prototype.isElement = goog.dom.isElement;\\n\\n\\n/**\\n * Returns true if the specified value is a Window object. This includes the\\n * global window for HTML pages, and iframe windows.\\n * @param {?} obj Variable to test.\\n * @return {boolean} Whether the variable is a window.\\n */\\ngoog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow;\\n\\n\\n/**\\n * Returns an element's parent, if it's an Element.\\n * @param {Element} element The DOM element.\\n * @return {Element} The parent, or null if not an Element.\\n */\\ngoog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement;\\n\\n\\n/**\\n * Whether a node contains another node.\\n * @param {Node} parent The node that should contain the other node.\\n * @param {Node} descendant The node to test presence of.\\n * @return {boolean} Whether the parent node contains the descendant node.\\n */\\ngoog.dom.DomHelper.prototype.contains = goog.dom.contains;\\n\\n\\n/**\\n * Compares the document order of two nodes, returning 0 if they are the same\\n * node, a negative number if node1 is before node2, and a positive number if\\n * node2 is before node1. Note that we compare the order the tags appear in the\\n * document so in the tree <b><i>text</i></b> the B node is considered to be\\n * before the I node.\\n *\\n * @param {Node} node1 The first node to compare.\\n * @param {Node} node2 The second node to compare.\\n * @return {number} 0 if the nodes are the same node, a negative number if node1\\n * is before node2, and a positive number if node2 is before node1.\\n */\\ngoog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder;\\n\\n\\n/**\\n * Find the deepest common ancestor of the given nodes.\\n * @param {...Node} var_args The nodes to find a common ancestor of.\\n * @return {Node} The common ancestor of the nodes, or null if there is none.\\n * null will only be returned if two or more of the nodes are from different\\n * documents.\\n */\\ngoog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor;\\n\\n\\n/**\\n * Returns the owner document for a node.\\n * @param {Node} node The node to get the document for.\\n * @return {!Document} The document owning the node.\\n */\\ngoog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument;\\n\\n\\n/**\\n * Cross browser function for getting the document element of an iframe.\\n * @param {Element} iframe Iframe element.\\n * @return {!Document} The frame content document.\\n */\\ngoog.dom.DomHelper.prototype.getFrameContentDocument =\\n goog.dom.getFrameContentDocument;\\n\\n\\n/**\\n * Cross browser function for getting the window of a frame or iframe.\\n * @param {Element} frame Frame element.\\n * @return {Window} The window associated with the given frame.\\n */\\ngoog.dom.DomHelper.prototype.getFrameContentWindow =\\n goog.dom.getFrameContentWindow;\\n\\n\\n/**\\n * Sets the text content of a node, with cross-browser support.\\n * @param {Node} node The node to change the text content of.\\n * @param {string|number} text The value that should replace the node's content.\\n */\\ngoog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent;\\n\\n\\n/**\\n * Gets the outerHTML of a node, which islike innerHTML, except that it\\n * actually contains the HTML of the node itself.\\n * @param {Element} element The element to get the HTML of.\\n * @return {string} The outerHTML of the given element.\\n */\\ngoog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml;\\n\\n\\n/**\\n * Finds the first descendant node that matches the filter function. This does\\n * a depth first search.\\n * @param {Node} root The root of the tree to search.\\n * @param {function(Node) : boolean} p The filter function.\\n * @return {Node|undefined} The found node or undefined if none is found.\\n */\\ngoog.dom.DomHelper.prototype.findNode = goog.dom.findNode;\\n\\n\\n/**\\n * Finds all the descendant nodes that matches the filter function. This does a\\n * depth first search.\\n * @param {Node} root The root of the tree to search.\\n * @param {function(Node) : boolean} p The filter function.\\n * @return {Array<Node>} The found nodes or an empty array if none are found.\\n */\\ngoog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes;\\n\\n\\n/**\\n * Returns true if the element has a tab index that allows it to receive\\n * keyboard focus (tabIndex >= 0), false otherwise. Note that some elements\\n * natively support keyboard focus, even if they have no tab index.\\n * @param {!Element} element Element to check.\\n * @return {boolean} Whether the element has a tab index that allows keyboard\\n * focus.\\n */\\ngoog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex;\\n\\n\\n/**\\n * Enables or disables keyboard focus support on the element via its tab index.\\n * Only elements for which {@link goog.dom.isFocusableTabIndex} returns true\\n * (or elements that natively support keyboard focus, like form elements) can\\n * receive keyboard focus. See http://go/tabindex for more info.\\n * @param {Element} element Element whose tab index is to be changed.\\n * @param {boolean} enable Whether to set or remove a tab index on the element\\n * that supports keyboard focus.\\n */\\ngoog.dom.DomHelper.prototype.setFocusableTabIndex =\\n goog.dom.setFocusableTabIndex;\\n\\n\\n/**\\n * Returns true if the element can be focused, i.e. it has a tab index that\\n * allows it to receive keyboard focus (tabIndex >= 0), or it is an element\\n * that natively supports keyboard focus.\\n * @param {!Element} element Element to check.\\n * @return {boolean} Whether the element allows keyboard focus.\\n */\\ngoog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable;\\n\\n\\n/**\\n * Returns the text contents of the current node, without markup. New lines are\\n * stripped and whitespace is collapsed, such that each character would be\\n * visible.\\n *\\n * In browsers that support it, innerText is used. Other browsers attempt to\\n * simulate it via node traversal. Line breaks are canonicalized in IE.\\n *\\n * @param {Node} node The node from which we are getting content.\\n * @return {string} The text content.\\n */\\ngoog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent;\\n\\n\\n/**\\n * Returns the text length of the text contained in a node, without markup. This\\n * is equivalent to the selection length if the node was selected, or the number\\n * of cursor movements to traverse the node. Images & BRs take one space. New\\n * lines are ignored.\\n *\\n * @param {Node} node The node whose text content length is being calculated.\\n * @return {number} The length of `node`'s text content.\\n */\\ngoog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength;\\n\\n\\n/**\\n * Returns the text offset of a node relative to one of its ancestors. The text\\n * length is the same as the length calculated by\\n * `goog.dom.getNodeTextLength`.\\n *\\n * @param {Node} node The node whose offset is being calculated.\\n * @param {Node=} opt_offsetParent Defaults to the node's owner document's body.\\n * @return {number} The text offset.\\n */\\ngoog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset;\\n\\n\\n/**\\n * Returns the node at a given offset in a parent node. If an object is\\n * provided for the optional third parameter, the node and the remainder of the\\n * offset will stored as properties of this object.\\n * @param {Node} parent The parent node.\\n * @param {number} offset The offset into the parent node.\\n * @param {Object=} opt_result Object to be used to store the return value. The\\n * return value will be stored in the form {node: Node, remainder: number}\\n * if this object is provided.\\n * @return {Node} The node at the given offset.\\n */\\ngoog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset;\\n\\n\\n/**\\n * Returns true if the object is a `NodeList`. To qualify as a NodeList,\\n * the object must have a numeric length property and an item function (which\\n * has type 'string' on IE for some reason).\\n * @param {Object} val Object to test.\\n * @return {boolean} Whether the object is a NodeList.\\n */\\ngoog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList;\\n\\n\\n/**\\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\\n * tag name and/or class name. If the passed element matches the specified\\n * criteria, the element itself is returned.\\n * @param {Node} element The DOM node to start with.\\n * @param {?(goog.dom.TagName<T>|string)=} opt_tag The tag name to match (or\\n * null/undefined to match only based on class name).\\n * @param {?string=} opt_class The class name to match (or null/undefined to\\n * match only based on tag name).\\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\\n * dom.\\n * @return {?R} The first ancestor that matches the passed criteria, or\\n * null if no match is found. The return type is {?Element} if opt_tag is\\n * not a member of goog.dom.TagName or a more specific type if it is (e.g.\\n * {?HTMLAnchorElement} for goog.dom.TagName.A).\\n * @template T\\n * @template R := cond(isUnknown(T), 'Element', T) =:\\n */\\ngoog.dom.DomHelper.prototype.getAncestorByTagNameAndClass =\\n goog.dom.getAncestorByTagNameAndClass;\\n\\n\\n/**\\n * Walks up the DOM hierarchy returning the first ancestor that has the passed\\n * class name. If the passed element matches the specified criteria, the\\n * element itself is returned.\\n * @param {Node} element The DOM node to start with.\\n * @param {string} class The class name to match.\\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\\n * dom.\\n * @return {Element} The first ancestor that matches the passed criteria, or\\n * null if none match.\\n */\\ngoog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass;\\n\\n\\n/**\\n * Walks up the DOM hierarchy returning the first ancestor that passes the\\n * matcher function.\\n * @param {Node} element The DOM node to start with.\\n * @param {function(Node) : boolean} matcher A function that returns true if the\\n * passed node matches the desired criteria.\\n * @param {boolean=} opt_includeNode If true, the node itself is included in\\n * the search (the first call to the matcher will pass startElement as\\n * the node to test).\\n * @param {number=} opt_maxSearchSteps Maximum number of levels to search up the\\n * dom.\\n * @return {Node} DOM node that matched the matcher, or null if there was\\n * no match.\\n */\\ngoog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor;\\n\\n\\n/**\\n * Gets '2d' context of a canvas. Shortcut for canvas.getContext('2d') with a\\n * type information.\\n * @param {!HTMLCanvasElement} canvas\\n * @return {!CanvasRenderingContext2D}\\n */\\ngoog.dom.DomHelper.prototype.getCanvasContext2D = goog.dom.getCanvasContext2D;\\n\"],\n\"names\":[\"goog\",\"provide\",\"require\",\"dom\",\"ASSUME_QUIRKS_MODE\",\"define\",\"ASSUME_STANDARDS_MODE\",\"COMPAT_MODE_KNOWN_\",\"getDomHelper\",\"goog.dom.getDomHelper\",\"opt_element\",\"DomHelper\",\"getOwnerDocument\",\"defaultDomHelper_\",\"getDocument\",\"goog.dom.getDocument\",\"document\",\"getElement\",\"goog.dom.getElement\",\"element\",\"getElementHelper_\",\"getHTMLElement\",\"goog.dom.getHTMLElement\",\"id\",\"asserts\",\"assertIsHtmlElement\",\"goog.dom.getElementHelper_\",\"doc\",\"getElementById\",\"getRequiredElement\",\"goog.dom.getRequiredElement\",\"getRequiredElementHelper_\",\"getRequiredHTMLElement\",\"goog.dom.getRequiredHTMLElement\",\"goog.dom.getRequiredElementHelper_\",\"assertString\",\"assert\",\"$\",\"getElementsByTagName\",\"goog.dom.getElementsByTagName\",\"tagName\",\"opt_parent\",\"parent\",\"String\",\"getElementsByTagNameAndClass\",\"goog.dom.getElementsByTagNameAndClass\",\"opt_tag\",\"opt_class\",\"opt_el\",\"getElementsByTagNameAndClass_\",\"getElementByTagNameAndClass\",\"goog.dom.getElementByTagNameAndClass\",\"getElementByTagNameAndClass_\",\"getElementsByClass\",\"goog.dom.getElementsByClass\",\"className\",\"canUseQuerySelector_\",\"querySelectorAll\",\"getElementByClass\",\"goog.dom.getElementByClass\",\"retVal\",\"getElementsByClassName\",\"getHTMLElementByClass\",\"goog.dom.getHTMLElementByClass\",\"getRequiredElementByClass\",\"goog.dom.getRequiredElementByClass\",\"opt_root\",\"retValue\",\"getRequiredHTMLElementByClass\",\"goog.dom.getRequiredHTMLElementByClass\",\"goog.dom.canUseQuerySelector_\",\"querySelector\",\"goog.dom.getElementsByTagNameAndClass_\",\"toUpperCase\",\"query\",\"els\",\"arrayLike\",\"len\",\"i\",\"el\",\"nodeName\",\"length\",\"split\",\"array\",\"contains\",\"goog.dom.getElementByTagNameAndClass_\",\"tag\",\"elements\",\"$$\",\"setProperties\",\"goog.dom.setProperties\",\"properties\",\"object\",\"forEach\",\"val\",\"key\",\"implementsGoogStringTypedString\",\"getTypedStringValue\",\"style\",\"cssText\",\"htmlFor\",\"DIRECT_ATTRIBUTE_MAP_\",\"hasOwnProperty\",\"setAttribute\",\"string\",\"startsWith\",\"getViewportSize\",\"goog.dom.getViewportSize\",\"opt_window\",\"getViewportSize_\",\"window\",\"goog.dom.getViewportSize_\",\"win\",\"isCss1CompatMode_\",\"documentElement\",\"body\",\"math\",\"Size\",\"clientWidth\",\"clientHeight\",\"getDocumentHeight\",\"goog.dom.getDocumentHeight\",\"getDocumentHeight_\",\"getDocumentHeightForWindow\",\"goog.dom.getDocumentHeightForWindow\",\"goog.dom.getDocumentHeight_\",\"height\",\"docEl\",\"vh\",\"scrollHeight\",\"offsetHeight\",\"sh\",\"oh\",\"getPageScroll\",\"goog.dom.getPageScroll\",\"global\",\"getDocumentScroll\",\"goog.dom.getDocumentScroll\",\"getDocumentScroll_\",\"goog.dom.getDocumentScroll_\",\"getDocumentScrollElement_\",\"getWindow_\",\"userAgent\",\"IE\",\"pageYOffset\",\"scrollTop\",\"Coordinate\",\"scrollLeft\",\"pageXOffset\",\"getDocumentScrollElement\",\"goog.dom.getDocumentScrollElement\",\"goog.dom.getDocumentScrollElement_\",\"scrollingElement\",\"WEBKIT\",\"getWindow\",\"goog.dom.getWindow\",\"opt_doc\",\"goog.dom.getWindow_\",\"parentWindow\",\"defaultView\",\"createDom\",\"goog.dom.createDom\",\"opt_attributes\",\"var_args\",\"createDom_\",\"arguments\",\"goog.dom.createDom_\",\"args\",\"attributes\",\"createElement_\",\"Array\",\"isArray\",\"join\",\"append_\",\"goog.dom.append_\",\"startIndex\",\"childHandler\",\"child\",\"appendChild\",\"createTextNode\",\"arg\",\"isArrayLike\",\"isNodeLike\",\"isNodeList\",\"toArray\",\"$dom\",\"createElement\",\"goog.dom.createElement\",\"name\",\"goog.dom.createElement_\",\"contentType\",\"toLowerCase\",\"goog.dom.createTextNode\",\"content\",\"createTable\",\"goog.dom.createTable\",\"rows\",\"columns\",\"opt_fillWithNbsp\",\"createTable_\",\"goog.dom.createTable_\",\"fillWithNbsp\",\"table\",\"TagName\",\"TABLE\",\"tbody\",\"TBODY\",\"tr\",\"TR\",\"j\",\"td\",\"TD\",\"setTextContent\",\"Unicode\",\"NBSP\",\"constHtmlToNode\",\"goog.dom.constHtmlToNode\",\"stringArray\",\"prototype\",\"map\",\"call\",\"Const\",\"unwrap\",\"safeHtml\",\"html\",\"uncheckedconversions\",\"safeHtmlFromStringKnownToSatisfyTypeContract\",\"from\",\"safeHtmlToNode\",\"goog.dom.safeHtmlToNode\",\"safeHtmlToNode_\",\"goog.dom.safeHtmlToNode_\",\"tempDiv\",\"DIV\",\"BrowserFeature\",\"INNER_HTML_NEEDS_SCOPED_ELEMENT\",\"safe\",\"setInnerHtml\",\"SafeHtml\",\"concat\",\"BR\",\"removeChild\",\"firstChild\",\"childrenToNode_\",\"goog.dom.childrenToNode_\",\"childNodes\",\"fragment\",\"createDocumentFragment\",\"isCss1CompatMode\",\"goog.dom.isCss1CompatMode\",\"goog.dom.isCss1CompatMode_\",\"compatMode\",\"canHaveChildren\",\"goog.dom.canHaveChildren\",\"node\",\"nodeType\",\"NodeType\",\"ELEMENT\",\"APPLET\",\"AREA\",\"BASE\",\"COL\",\"COMMAND\",\"EMBED\",\"FRAME\",\"HR\",\"IMG\",\"INPUT\",\"IFRAME\",\"ISINDEX\",\"KEYGEN\",\"LINK\",\"NOFRAMES\",\"NOSCRIPT\",\"META\",\"OBJECT\",\"PARAM\",\"SCRIPT\",\"SOURCE\",\"STYLE\",\"TRACK\",\"WBR\",\"goog.dom.appendChild\",\"append\",\"goog.dom.append\",\"removeChildren\",\"goog.dom.removeChildren\",\"insertSiblingBefore\",\"goog.dom.insertSiblingBefore\",\"newNode\",\"refNode\",\"parentNode\",\"insertBefore\",\"insertSiblingAfter\",\"goog.dom.insertSiblingAfter\",\"nextSibling\",\"insertChildAt\",\"goog.dom.insertChildAt\",\"index\",\"removeNode\",\"goog.dom.removeNode\",\"replaceNode\",\"goog.dom.replaceNode\",\"oldNode\",\"replaceChild\",\"copyContents\",\"goog.dom.copyContents\",\"target\",\"source\",\"cloneNode\",\"flattenElement\",\"goog.dom.flattenElement\",\"DOCUMENT_FRAGMENT\",\"getChildren\",\"goog.dom.getChildren\",\"children\",\"undefined\",\"filter\",\"getFirstElementChild\",\"goog.dom.getFirstElementChild\",\"firstElementChild\",\"getNextElementNode_\",\"getLastElementChild\",\"goog.dom.getLastElementChild\",\"lastElementChild\",\"lastChild\",\"getNextElementSibling\",\"goog.dom.getNextElementSibling\",\"nextElementSibling\",\"getPreviousElementSibling\",\"goog.dom.getPreviousElementSibling\",\"previousElementSibling\",\"previousSibling\",\"goog.dom.getNextElementNode_\",\"forward\",\"getNextNode\",\"goog.dom.getNextNode\",\"getPreviousNode\",\"goog.dom.getPreviousNode\",\"goog.dom.isNodeLike\",\"obj\",\"isObject\",\"isElement\",\"goog.dom.isElement\",\"isWindow\",\"goog.dom.isWindow\",\"getParentElement\",\"goog.dom.getParentElement\",\"CAN_USE_PARENT_ELEMENT_PROPERTY\",\"parentElement\",\"goog.dom.contains\",\"descendant\",\"compareDocumentPosition\",\"Boolean\",\"compareNodeOrder\",\"goog.dom.compareNodeOrder\",\"node1\",\"node2\",\"isDocumentModeOrHigher\",\"DOCUMENT\",\"isElement1\",\"isElement2\",\"sourceIndex\",\"parent1\",\"parent2\",\"compareSiblingOrder_\",\"compareParentsDescendantNodeIe_\",\"range1\",\"range2\",\"createRange\",\"selectNode\",\"collapse\",\"compareBoundaryPoints\",\"START_TO_END\",\"goog.dom.compareParentsDescendantNodeIe_\",\"textNode\",\"sibling\",\"goog.dom.compareSiblingOrder_\",\"s\",\"findCommonAncestor\",\"goog.dom.findCommonAncestor\",\"count\",\"paths\",\"minLength\",\"Infinity\",\"ancestors\",\"unshift\",\"push\",\"Math\",\"min\",\"output\",\"first\",\"isInDocument\",\"goog.dom.isInDocument\",\"ownerDocument\",\"goog.dom.getOwnerDocument\",\"getFrameContentDocument\",\"goog.dom.getFrameContentDocument\",\"frame\",\"contentDocument\",\"contentWindow\",\"getFrameContentWindow\",\"goog.dom.getFrameContentWindow\",\"e\",\"goog.dom.setTextContent\",\"text\",\"textContent\",\"TEXT\",\"data\",\"getOuterHtml\",\"goog.dom.getOuterHtml\",\"outerHTML\",\"div\",\"innerHTML\",\"findNode\",\"goog.dom.findNode\",\"root\",\"p\",\"rv\",\"found\",\"findNodes_\",\"findNodes\",\"goog.dom.findNodes\",\"goog.dom.findNodes_\",\"findOne\",\"findElement\",\"goog.dom.findElement\",\"pred\",\"stack\",\"getChildrenReverse_\",\"next\",\"pop\",\"c\",\"findElements\",\"goog.dom.findElements\",\"result\",\"goog.dom.getChildrenReverse_\",\"TAGS_TO_IGNORE_\",\"PREDEFINED_TAG_VALUES_\",\"isFocusableTabIndex\",\"goog.dom.isFocusableTabIndex\",\"hasSpecifiedTabIndex_\",\"isTabIndexFocusable_\",\"setFocusableTabIndex\",\"goog.dom.setFocusableTabIndex\",\"enable\",\"tabIndex\",\"removeAttribute\",\"isFocusable\",\"goog.dom.isFocusable\",\"focusable\",\"nativelySupportsFocus_\",\"disabled\",\"hasNonZeroBoundingRect_\",\"goog.dom.hasSpecifiedTabIndex_\",\"hasAttribute\",\"goog.dom.isTabIndexFocusable_\",\"goog.dom.nativelySupportsFocus_\",\"A\",\"TEXTAREA\",\"SELECT\",\"BUTTON\",\"goog.dom.hasNonZeroBoundingRect_\",\"rect\",\"offsetWidth\",\"getBoundingClientRect\",\"width\",\"getTextContent\",\"goog.dom.getTextContent\",\"buf\",\"getTextContent_\",\"replace\",\"getRawTextContent\",\"goog.dom.getRawTextContent\",\"goog.dom.getTextContent_\",\"normalizeWhitespace\",\"nodeValue\",\"getNodeTextLength\",\"goog.dom.getNodeTextLength\",\"getNodeTextOffset\",\"goog.dom.getNodeTextOffset\",\"opt_offsetParent\",\"cur\",\"trimLeft\",\"getNodeAtOffset\",\"goog.dom.getNodeAtOffset\",\"offset\",\"opt_result\",\"pos\",\"remainder\",\"goog.dom.isNodeList\",\"item\",\"getAncestorByTagNameAndClass\",\"goog.dom.getAncestorByTagNameAndClass\",\"opt_maxSearchSteps\",\"getAncestor\",\"getAncestorByClass\",\"goog.dom.getAncestorByClass\",\"goog.dom.getAncestor\",\"matcher\",\"opt_includeNode\",\"steps\",\"getActiveElement\",\"goog.dom.getActiveElement\",\"activeElement\",\"getPixelRatio\",\"goog.dom.getPixelRatio\",\"devicePixelRatio\",\"matchMedia\",\"matchesPixelRatio_\",\"goog.dom.matchesPixelRatio_\",\"pixelRatio\",\"dpiPerDppx\",\"matches\",\"getCanvasContext2D\",\"goog.dom.getCanvasContext2D\",\"canvas\",\"getContext\",\"goog.dom.DomHelper\",\"opt_document\",\"document_\",\"setDocument\",\"goog.dom.DomHelper.prototype.setDocument\",\"goog.dom.DomHelper.prototype.getDocument\",\"goog.dom.DomHelper.prototype.getElement\",\"goog.dom.DomHelper.prototype.getRequiredElement\",\"goog.dom.DomHelper.prototype.getElementsByTagName\",\"goog.dom.DomHelper.prototype.getElementsByTagNameAndClass\",\"goog.dom.DomHelper.prototype.getElementByTagNameAndClass\",\"goog.dom.DomHelper.prototype.getElementsByClass\",\"goog.dom.DomHelper.prototype.getElementByClass\",\"goog.dom.DomHelper.prototype.getRequiredElementByClass\",\"goog.dom.DomHelper.prototype.getViewportSize\",\"goog.dom.DomHelper.prototype.getDocumentHeight\",\"Appendable\",\"goog.dom.DomHelper.prototype.createDom\",\"goog.dom.DomHelper.prototype.createElement\",\"goog.dom.DomHelper.prototype.createTextNode\",\"goog.dom.DomHelper.prototype.createTable\",\"goog.dom.DomHelper.prototype.safeHtmlToNode\",\"goog.dom.DomHelper.prototype.isCss1CompatMode\",\"goog.dom.DomHelper.prototype.getWindow\",\"goog.dom.DomHelper.prototype.getDocumentScrollElement\",\"goog.dom.DomHelper.prototype.getDocumentScroll\",\"goog.dom.DomHelper.prototype.getActiveElement\"]\n}\n"]