Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: static/dist/js/vendor/classList.js.map

Issue 29624561: Issue 6104 - Minified code in help center repository (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Patch Set: Move all requires to top of gulpfile.js Created Dec. 4, 2017, 2:10 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 {"version":3,"names":[],"mappings":"","sources":["classList.js"],"sourcesContent ":["/*!\n * classList.js: Cross-browser full element.classList implementation.\n * 1.2.201711092\n *\n * By Eli Grey, http://eligrey.com\n * License: Dedicated to the public domain.\n * See https://github.com/eligrey/classList.js/blob/mas ter/LICENSE.md\n */\n\n/*global self, document, DOMException */\n\n/*! @source h ttp://purl.eligrey.com/github/classList.js/blob/master/classList.js */\n\nif (\" document\" in self) {\n \n // Full polyfill for browsers with no classList sup port\n // Including IE < Edge missing SVGElement.classList\n if (\n !(\" classList\" in document.createElement(\"_\")) \n || document.createElementNS\ n && !(\"classList\" in document.createElementNS(\"http://www.w3.org/2000/svg \",\"g\"))\n ) {\n \n (function (view) {\n \n \"use strict\";\n \n if (!( 'Element' in view)) return;\n \n var\n classListProp = \"classList\"\n , protoProp = \"prototype\"\n , elemCtrProto = view.Element[protoProp]\n , objCtr = Object\n , strTrim = String[protoProp].trim || function () {\n return this.replace(/^\\s+|\\s+$/g, \"\");\n }\n , arrIndexOf = Array[pr otoProp].indexOf || function (item) {\n var\n i = 0\n , len = this.length\n ;\n for (; i < len; i++) {\n if (i in this && this[i] === item) {\n return i;\n }\n }\n return -1;\n }\n // Vendors: please allow content code to instantiate DOMExceptions\n , DOMEx = function (type, message) {\n this.name = type;\n this.cod e = DOMException[type];\n this.message = message;\n }\n , checkTokenA ndGetIndex = function (classList, token) {\n if (token === \"\") {\n throw new DOMEx(\n \"SYNTAX_ERR\"\n , \"The token must not be empty.\"\n );\n }\n if (/\\s/.test(token)) {\n throw new DOMEx(\n \"INVALID_CHARACTER_ERR\"\n , \"The token must not contain space characters.\"\n );\n }\n return arrIndexOf.ca ll(classList, token);\n }\n , ClassList = function (elem) {\n var\n trimmedClasses = strTrim.call(elem.getAttribute(\"class\") || \"\")\n , classes = trimmedClasses ? trimmedClasses.split(/\\s+/) : []\n , i = 0\n , len = classes.length\n ;\n for (; i < len; i++) {\n this.push(classes[i]);\n }\n this._updateClassName = function () {\n elem.setAttribute(\"class\", this.toString());\n };\n }\n , classListProto = ClassList[protoProp] = []\n , classListGetter = function ( ) {\n return new ClassList(this);\n }\n ;\n // Most DOMException imple mentations don't allow calling DOMException's toString()\n // on non-DOMExcepti ons. Error's toString() is sufficient here.\n DOMEx[protoProp] = Error[protoPro p];\n classListProto.item = function (i) {\n return this[i] || null;\n };\n classListProto.contains = function (token) {\n return !~checkTokenAndGetInd ex(this, token + \"\");\n };\n classListProto.add = function () {\n var\n tokens = arguments\n , i = 0\n , l = tokens.length\n , toke n\n , updated = false\n ;\n do {\n token = tokens[i] + \"\";\n if (~checkTokenAndGetIndex(this, token)) {\n this.push(token);\n updated = true;\n }\n }\n while (++i < l);\n \n if (updated) { \n this._updateClassName();\n }\n };\n classListProto.remove = functio n () {\n var\n tokens = arguments\n , i = 0\n , l = tokens.l ength\n , token\n , updated = false\n , index\n ;\n do {\n token = tokens[i] + \"\";\n index = checkTokenAndGetIndex(this, token) ;\n while (~index) {\n this.splice(index, 1);\n updated = tru e;\n index = checkTokenAndGetIndex(this, token);\n }\n }\n whi le (++i < l);\n \n if (updated) {\n this._updateClassName();\n }\n };\n classListProto.toggle = function (token, force) {\n var\n result = this.contains(token)\n , method = result ?\n force !== true && \" remove\"\n :\n force !== false && \"add\"\n ;\n \n if (method ) {\n this[method](token);\n }\n \n if (force === true || force === false) {\n return force;\n } else {\n return !result;\n }\n };\ n classListProto.replace = function (token, replacement_token) {\n var index = checkTokenAndGetIndex(token + \"\");\n if (~index) {\n this.splice(in dex, 1, replacement_token);\n this._updateClassName();\n }\n }\n class ListProto.toString = function () {\n return this.join(\" \");\n };\n \n if (objCtr.defineProperty) {\n var classListPropDesc = {\n get: classLis tGetter\n , enumerable: true\n , configurable: true\n };\n try { \n objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);\n } catch (ex) { // IE 8 doesn't support enumerable:true\n // adding unde fined to fight this issue https://github.com/eligrey/classList.js/issues/36\n // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected\n if (ex.number === undefined || ex.number === -0x7FF5EC54) {\n classListProp Desc.enumerable = false;\n objCtr.defineProperty(elemCtrProto, classListP rop, classListPropDesc);\n }\n }\n } else if (objCtr[protoProp].__defin eGetter__) {\n elemCtrProto.__defineGetter__(classListProp, classListGetter); \n }\n \n }(self));\n \n }\n \n // There is full or partial native classL ist support, so just check if we need\n // to normalize the add/remove and togg le APIs.\n \n (function () {\n \"use strict\";\n \n var testElement = d ocument.createElement(\"_\");\n \n testElement.classList.add(\"c1\", \"c2\") ;\n \n // Polyfill for IE 10/11 and Firefox <26, where classList.add and\n // classList.remove exist but support only one argument at a time.\n if (!t estElement.classList.contains(\"c2\")) {\n var createMethod = function(meth od) {\n var original = DOMTokenList.prototype[method];\n \n DOMTo kenList.prototype[method] = function(token) {\n var i, len = arguments. length;\n \n for (i = 0; i < len; i++) {\n token = argument s[i];\n original.call(this, token);\n }\n };\n } ;\n createMethod('add');\n createMethod('remove');\n }\n \n tes tElement.classList.toggle(\"c3\", false);\n \n // Polyfill for IE 10 and Fir efox <24, where classList.toggle does not\n // support the second argument.\n if (testElement.classList.contains(\"c3\")) {\n var _toggle = DOMTokenL ist.prototype.toggle;\n \n DOMTokenList.prototype.toggle = function(token, force) {\n if (1 in arguments && !this.contains(token) === !force) {\n return force;\n } else {\n return _toggle.call(this, tok en);\n }\n };\n \n }\n \n // replace() polyfill\n if (!(\ "replace\" in document.createElement(\"_\").classList)) {\n DOMTokenList.pr ototype.replace = function (token, replacement_token) {\n var\n tokens = this.toString().split(\" \")\n , index = tokens.indexOf(toke n + \"\")\n ;\n if (~index) {\n tokens = tokens.slice(ind ex);\n this.remove.apply(this, tokens);\n this.add(replacement _token);\n this.add.apply(this, tokens.slice(1));\n }\n }\n }\n \n testElement = null;\n }());\n \n }"],"file":"classList.js"}
OLDNEW

Powered by Google App Engine
This is Rietveld