wp/wp-includes/js/dist/token-list.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    80 /******/ 	// __webpack_public_path__
    80 /******/ 	// __webpack_public_path__
    81 /******/ 	__webpack_require__.p = "";
    81 /******/ 	__webpack_require__.p = "";
    82 /******/
    82 /******/
    83 /******/
    83 /******/
    84 /******/ 	// Load entry module and return exports
    84 /******/ 	// Load entry module and return exports
    85 /******/ 	return __webpack_require__(__webpack_require__.s = 353);
    85 /******/ 	return __webpack_require__(__webpack_require__.s = 432);
    86 /******/ })
    86 /******/ })
    87 /************************************************************************/
    87 /************************************************************************/
    88 /******/ ({
    88 /******/ ({
    89 
    89 
    90 /***/ 10:
    90 /***/ 19:
    91 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
    92 
       
    93 "use strict";
       
    94 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
       
    95 function _classCallCheck(instance, Constructor) {
       
    96   if (!(instance instanceof Constructor)) {
       
    97     throw new TypeError("Cannot call a class as a function");
       
    98   }
       
    99 }
       
   100 
       
   101 /***/ }),
       
   102 
       
   103 /***/ 2:
       
   104 /***/ (function(module, exports) {
       
   105 
       
   106 (function() { module.exports = this["lodash"]; }());
       
   107 
       
   108 /***/ }),
       
   109 
       
   110 /***/ 353:
       
   111 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   112 
       
   113 "use strict";
       
   114 __webpack_require__.r(__webpack_exports__);
       
   115 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TokenList; });
       
   116 /* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
       
   117 /* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
       
   118 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
       
   119 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
       
   120 
       
   121 
       
   122 
       
   123 /**
       
   124  * External dependencies
       
   125  */
       
   126 
       
   127 /**
       
   128  * A set of tokens.
       
   129  *
       
   130  * @link https://dom.spec.whatwg.org/#domtokenlist
       
   131  */
       
   132 
       
   133 var TokenList =
       
   134 /*#__PURE__*/
       
   135 function () {
       
   136   /**
       
   137    * Constructs a new instance of TokenList.
       
   138    *
       
   139    * @param {string} initialValue Initial value to assign.
       
   140    */
       
   141   function TokenList() {
       
   142     var _this = this;
       
   143 
       
   144     var initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
       
   145 
       
   146     Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(this, TokenList);
       
   147 
       
   148     this.value = initialValue;
       
   149     ['entries', 'forEach', 'keys', 'values'].forEach(function (fn) {
       
   150       _this[fn] = function () {
       
   151         var _this$_valueAsArray;
       
   152 
       
   153         return (_this$_valueAsArray = this._valueAsArray)[fn].apply(_this$_valueAsArray, arguments);
       
   154       }.bind(_this);
       
   155     });
       
   156   }
       
   157   /**
       
   158    * Returns the associated set as string.
       
   159    *
       
   160    * @link https://dom.spec.whatwg.org/#dom-domtokenlist-value
       
   161    *
       
   162    * @return {string} Token set as string.
       
   163    */
       
   164 
       
   165 
       
   166   Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(TokenList, [{
       
   167     key: "toString",
       
   168 
       
   169     /**
       
   170      * Returns the stringified form of the TokenList.
       
   171      *
       
   172      * @link https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior
       
   173      * @link https://www.ecma-international.org/ecma-262/9.0/index.html#sec-tostring
       
   174      *
       
   175      * @return {string} Token set as string.
       
   176      */
       
   177     value: function toString() {
       
   178       return this.value;
       
   179     }
       
   180     /**
       
   181      * Returns an iterator for the TokenList, iterating items of the set.
       
   182      *
       
   183      * @link https://dom.spec.whatwg.org/#domtokenlist
       
   184      *
       
   185      * @return {Generator} TokenList iterator.
       
   186      */
       
   187 
       
   188   }, {
       
   189     key: Symbol.iterator,
       
   190     value:
       
   191     /*#__PURE__*/
       
   192     regeneratorRuntime.mark(function value() {
       
   193       return regeneratorRuntime.wrap(function value$(_context) {
       
   194         while (1) {
       
   195           switch (_context.prev = _context.next) {
       
   196             case 0:
       
   197               return _context.delegateYield(this._valueAsArray, "t0", 1);
       
   198 
       
   199             case 1:
       
   200               return _context.abrupt("return", _context.t0);
       
   201 
       
   202             case 2:
       
   203             case "end":
       
   204               return _context.stop();
       
   205           }
       
   206         }
       
   207       }, value, this);
       
   208     })
       
   209     /**
       
   210      * Returns the token with index `index`.
       
   211      *
       
   212      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-item
       
   213      *
       
   214      * @param {number} index Index at which to return token.
       
   215      *
       
   216      * @return {?string} Token at index.
       
   217      */
       
   218 
       
   219   }, {
       
   220     key: "item",
       
   221     value: function item(index) {
       
   222       return this._valueAsArray[index];
       
   223     }
       
   224     /**
       
   225      * Returns true if `token` is present, and false otherwise.
       
   226      *
       
   227      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-contains
       
   228      *
       
   229      * @param {string} item Token to test.
       
   230      *
       
   231      * @return {boolean} Whether token is present.
       
   232      */
       
   233 
       
   234   }, {
       
   235     key: "contains",
       
   236     value: function contains(item) {
       
   237       return this._valueAsArray.indexOf(item) !== -1;
       
   238     }
       
   239     /**
       
   240      * Adds all arguments passed, except those already present.
       
   241      *
       
   242      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-add
       
   243      *
       
   244      * @param {...string} items Items to add.
       
   245      */
       
   246 
       
   247   }, {
       
   248     key: "add",
       
   249     value: function add() {
       
   250       for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
       
   251         items[_key] = arguments[_key];
       
   252       }
       
   253 
       
   254       this.value += ' ' + items.join(' ');
       
   255     }
       
   256     /**
       
   257      * Removes arguments passed, if they are present.
       
   258      *
       
   259      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-remove
       
   260      *
       
   261      * @param {...string} items Items to remove.
       
   262      */
       
   263 
       
   264   }, {
       
   265     key: "remove",
       
   266     value: function remove() {
       
   267       for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
       
   268         items[_key2] = arguments[_key2];
       
   269       }
       
   270 
       
   271       this.value = lodash__WEBPACK_IMPORTED_MODULE_2__["without"].apply(void 0, [this._valueAsArray].concat(items)).join(' ');
       
   272     }
       
   273     /**
       
   274      * If `force` is not given, "toggles" `token`, removing it if it’s present
       
   275      * and adding it if it’s not present. If `force` is true, adds token (same
       
   276      * as add()). If force is false, removes token (same as remove()). Returns
       
   277      * true if `token` is now present, and false otherwise.
       
   278      *
       
   279      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-toggle
       
   280      *
       
   281      * @param {string}   token Token to toggle.
       
   282      * @param {?boolean} force Presence to force.
       
   283      *
       
   284      * @return {boolean} Whether token is present after toggle.
       
   285      */
       
   286 
       
   287   }, {
       
   288     key: "toggle",
       
   289     value: function toggle(token, force) {
       
   290       if (undefined === force) {
       
   291         force = !this.contains(token);
       
   292       }
       
   293 
       
   294       if (force) {
       
   295         this.add(token);
       
   296       } else {
       
   297         this.remove(token);
       
   298       }
       
   299 
       
   300       return force;
       
   301     }
       
   302     /**
       
   303      * Replaces `token` with `newToken`. Returns true if `token` was replaced
       
   304      * with `newToken`, and false otherwise.
       
   305      *
       
   306      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-replace
       
   307      *
       
   308      * @param {string} token    Token to replace with `newToken`.
       
   309      * @param {string} newToken Token to use in place of `token`.
       
   310      *
       
   311      * @return {boolean} Whether replacement occurred.
       
   312      */
       
   313 
       
   314   }, {
       
   315     key: "replace",
       
   316     value: function replace(token, newToken) {
       
   317       if (!this.contains(token)) {
       
   318         return false;
       
   319       }
       
   320 
       
   321       this.remove(token);
       
   322       this.add(newToken);
       
   323       return true;
       
   324     }
       
   325     /**
       
   326      * Returns true if `token` is in the associated attribute’s supported
       
   327      * tokens. Returns false otherwise.
       
   328      *
       
   329      * Always returns `true` in this implementation.
       
   330      *
       
   331      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-supports
       
   332      *
       
   333      * @return {boolean} Whether token is supported.
       
   334      */
       
   335 
       
   336   }, {
       
   337     key: "supports",
       
   338     value: function supports() {
       
   339       return true;
       
   340     }
       
   341   }, {
       
   342     key: "value",
       
   343     get: function get() {
       
   344       return this._currentValue;
       
   345     }
       
   346     /**
       
   347      * Replaces the associated set with a new string value.
       
   348      *
       
   349      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-value
       
   350      *
       
   351      * @param {string} value New token set as string.
       
   352      */
       
   353     ,
       
   354     set: function set(value) {
       
   355       value = String(value);
       
   356       this._valueAsArray = Object(lodash__WEBPACK_IMPORTED_MODULE_2__["uniq"])(Object(lodash__WEBPACK_IMPORTED_MODULE_2__["compact"])(value.split(/\s+/g)));
       
   357       this._currentValue = this._valueAsArray.join(' ');
       
   358     }
       
   359     /**
       
   360      * Returns the number of tokens.
       
   361      *
       
   362      * @link https://dom.spec.whatwg.org/#dom-domtokenlist-length
       
   363      *
       
   364      * @return {number} Number of tokens.
       
   365      */
       
   366 
       
   367   }, {
       
   368     key: "length",
       
   369     get: function get() {
       
   370       return this._valueAsArray.length;
       
   371     }
       
   372   }]);
       
   373 
       
   374   return TokenList;
       
   375 }();
       
   376 
       
   377 
       
   378 
       
   379 
       
   380 /***/ }),
       
   381 
       
   382 /***/ 9:
       
   383 /***/ (function(module, __webpack_exports__, __webpack_require__) {
    91 /***/ (function(module, __webpack_exports__, __webpack_require__) {
   384 
    92 
   385 "use strict";
    93 "use strict";
   386 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
    94 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
   387 function _defineProperties(target, props) {
    95 function _defineProperties(target, props) {
   398   if (protoProps) _defineProperties(Constructor.prototype, protoProps);
   106   if (protoProps) _defineProperties(Constructor.prototype, protoProps);
   399   if (staticProps) _defineProperties(Constructor, staticProps);
   107   if (staticProps) _defineProperties(Constructor, staticProps);
   400   return Constructor;
   108   return Constructor;
   401 }
   109 }
   402 
   110 
       
   111 /***/ }),
       
   112 
       
   113 /***/ 2:
       
   114 /***/ (function(module, exports) {
       
   115 
       
   116 (function() { module.exports = this["lodash"]; }());
       
   117 
       
   118 /***/ }),
       
   119 
       
   120 /***/ 20:
       
   121 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   122 
       
   123 "use strict";
       
   124 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
       
   125 function _classCallCheck(instance, Constructor) {
       
   126   if (!(instance instanceof Constructor)) {
       
   127     throw new TypeError("Cannot call a class as a function");
       
   128   }
       
   129 }
       
   130 
       
   131 /***/ }),
       
   132 
       
   133 /***/ 24:
       
   134 /***/ (function(module, exports) {
       
   135 
       
   136 (function() { module.exports = this["regeneratorRuntime"]; }());
       
   137 
       
   138 /***/ }),
       
   139 
       
   140 /***/ 432:
       
   141 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   142 
       
   143 "use strict";
       
   144 __webpack_require__.r(__webpack_exports__);
       
   145 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return TokenList; });
       
   146 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
       
   147 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
       
   148 /* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20);
       
   149 /* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19);
       
   150 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
       
   151 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
       
   152 
       
   153 
       
   154 
       
   155 
       
   156 /**
       
   157  * External dependencies
       
   158  */
       
   159 
       
   160 /**
       
   161  * A set of tokens.
       
   162  *
       
   163  * @see https://dom.spec.whatwg.org/#domtokenlist
       
   164  */
       
   165 
       
   166 var TokenList = /*#__PURE__*/function () {
       
   167   /**
       
   168    * Constructs a new instance of TokenList.
       
   169    *
       
   170    * @param {string} initialValue Initial value to assign.
       
   171    */
       
   172   function TokenList() {
       
   173     var initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
       
   174 
       
   175     Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(this, TokenList);
       
   176 
       
   177     this.value = initialValue; // Disable reason: These are type hints on the class.
       
   178 
       
   179     /* eslint-disable no-unused-expressions */
       
   180 
       
   181     /** @type {string} */
       
   182 
       
   183     this._currentValue;
       
   184     /** @type {string[]} */
       
   185 
       
   186     this._valueAsArray;
       
   187     /* eslint-enable no-unused-expressions */
       
   188   } // Disable reason: JSDoc lint doesn't understand TypeScript types
       
   189 
       
   190   /* eslint-disable jsdoc/valid-types */
       
   191 
       
   192   /**
       
   193    * @param {Parameters<Array<string>['entries']>} args
       
   194    */
       
   195 
       
   196 
       
   197   Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(TokenList, [{
       
   198     key: "entries",
       
   199     value: function entries() {
       
   200       var _this$_valueAsArray;
       
   201 
       
   202       return (_this$_valueAsArray = this._valueAsArray).entries.apply(_this$_valueAsArray, arguments);
       
   203     }
       
   204     /**
       
   205      * @param {Parameters<Array<string>['forEach']>} args
       
   206      */
       
   207 
       
   208   }, {
       
   209     key: "forEach",
       
   210     value: function forEach() {
       
   211       var _this$_valueAsArray2;
       
   212 
       
   213       return (_this$_valueAsArray2 = this._valueAsArray).forEach.apply(_this$_valueAsArray2, arguments);
       
   214     }
       
   215     /**
       
   216      * @param {Parameters<Array<string>['keys']>} args
       
   217      */
       
   218 
       
   219   }, {
       
   220     key: "keys",
       
   221     value: function keys() {
       
   222       var _this$_valueAsArray3;
       
   223 
       
   224       return (_this$_valueAsArray3 = this._valueAsArray).keys.apply(_this$_valueAsArray3, arguments);
       
   225     }
       
   226     /**
       
   227      * @param {Parameters<Array<string>['values']>} args
       
   228      */
       
   229 
       
   230   }, {
       
   231     key: "values",
       
   232     value: function values() {
       
   233       var _this$_valueAsArray4;
       
   234 
       
   235       return (_this$_valueAsArray4 = this._valueAsArray).values.apply(_this$_valueAsArray4, arguments);
       
   236     }
       
   237     /* eslint-enable jsdoc/valid-types */
       
   238 
       
   239     /**
       
   240      * Returns the associated set as string.
       
   241      *
       
   242      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value
       
   243      *
       
   244      * @return {string} Token set as string.
       
   245      */
       
   246 
       
   247   }, {
       
   248     key: "toString",
       
   249 
       
   250     /**
       
   251      * Returns the stringified form of the TokenList.
       
   252      *
       
   253      * @see https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior
       
   254      * @see https://www.ecma-international.org/ecma-262/9.0/index.html#sec-tostring
       
   255      *
       
   256      * @return {string} Token set as string.
       
   257      */
       
   258     value: function toString() {
       
   259       return this.value;
       
   260     }
       
   261     /**
       
   262      * Returns an iterator for the TokenList, iterating items of the set.
       
   263      *
       
   264      * @see https://dom.spec.whatwg.org/#domtokenlist
       
   265      *
       
   266      * @return {IterableIterator<string>} TokenList iterator.
       
   267      */
       
   268 
       
   269   }, {
       
   270     key: Symbol.iterator,
       
   271     value: /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function value() {
       
   272       return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function value$(_context) {
       
   273         while (1) {
       
   274           switch (_context.prev = _context.next) {
       
   275             case 0:
       
   276               return _context.delegateYield(this._valueAsArray, "t0", 1);
       
   277 
       
   278             case 1:
       
   279               return _context.abrupt("return", _context.t0);
       
   280 
       
   281             case 2:
       
   282             case "end":
       
   283               return _context.stop();
       
   284           }
       
   285         }
       
   286       }, value, this);
       
   287     })
       
   288     /**
       
   289      * Returns the token with index `index`.
       
   290      *
       
   291      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-item
       
   292      *
       
   293      * @param {number} index Index at which to return token.
       
   294      *
       
   295      * @return {string|undefined} Token at index.
       
   296      */
       
   297 
       
   298   }, {
       
   299     key: "item",
       
   300     value: function item(index) {
       
   301       return this._valueAsArray[index];
       
   302     }
       
   303     /**
       
   304      * Returns true if `token` is present, and false otherwise.
       
   305      *
       
   306      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-contains
       
   307      *
       
   308      * @param {string} item Token to test.
       
   309      *
       
   310      * @return {boolean} Whether token is present.
       
   311      */
       
   312 
       
   313   }, {
       
   314     key: "contains",
       
   315     value: function contains(item) {
       
   316       return this._valueAsArray.indexOf(item) !== -1;
       
   317     }
       
   318     /**
       
   319      * Adds all arguments passed, except those already present.
       
   320      *
       
   321      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-add
       
   322      *
       
   323      * @param {...string} items Items to add.
       
   324      */
       
   325 
       
   326   }, {
       
   327     key: "add",
       
   328     value: function add() {
       
   329       for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
       
   330         items[_key] = arguments[_key];
       
   331       }
       
   332 
       
   333       this.value += ' ' + items.join(' ');
       
   334     }
       
   335     /**
       
   336      * Removes arguments passed, if they are present.
       
   337      *
       
   338      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-remove
       
   339      *
       
   340      * @param {...string} items Items to remove.
       
   341      */
       
   342 
       
   343   }, {
       
   344     key: "remove",
       
   345     value: function remove() {
       
   346       for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
       
   347         items[_key2] = arguments[_key2];
       
   348       }
       
   349 
       
   350       this.value = lodash__WEBPACK_IMPORTED_MODULE_3__["without"].apply(void 0, [this._valueAsArray].concat(items)).join(' ');
       
   351     }
       
   352     /**
       
   353      * If `force` is not given, "toggles" `token`, removing it if it’s present
       
   354      * and adding it if it’s not present. If `force` is true, adds token (same
       
   355      * as add()). If force is false, removes token (same as remove()). Returns
       
   356      * true if `token` is now present, and false otherwise.
       
   357      *
       
   358      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-toggle
       
   359      *
       
   360      * @param {string}  token   Token to toggle.
       
   361      * @param {boolean} [force] Presence to force.
       
   362      *
       
   363      * @return {boolean} Whether token is present after toggle.
       
   364      */
       
   365 
       
   366   }, {
       
   367     key: "toggle",
       
   368     value: function toggle(token, force) {
       
   369       if (undefined === force) {
       
   370         force = !this.contains(token);
       
   371       }
       
   372 
       
   373       if (force) {
       
   374         this.add(token);
       
   375       } else {
       
   376         this.remove(token);
       
   377       }
       
   378 
       
   379       return force;
       
   380     }
       
   381     /**
       
   382      * Replaces `token` with `newToken`. Returns true if `token` was replaced
       
   383      * with `newToken`, and false otherwise.
       
   384      *
       
   385      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-replace
       
   386      *
       
   387      * @param {string} token    Token to replace with `newToken`.
       
   388      * @param {string} newToken Token to use in place of `token`.
       
   389      *
       
   390      * @return {boolean} Whether replacement occurred.
       
   391      */
       
   392 
       
   393   }, {
       
   394     key: "replace",
       
   395     value: function replace(token, newToken) {
       
   396       if (!this.contains(token)) {
       
   397         return false;
       
   398       }
       
   399 
       
   400       this.remove(token);
       
   401       this.add(newToken);
       
   402       return true;
       
   403     }
       
   404     /**
       
   405      * Returns true if `token` is in the associated attribute’s supported
       
   406      * tokens. Returns false otherwise.
       
   407      *
       
   408      * Always returns `true` in this implementation.
       
   409      *
       
   410      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports
       
   411      *
       
   412      * @return {boolean} Whether token is supported.
       
   413      */
       
   414 
       
   415   }, {
       
   416     key: "supports",
       
   417     value: function supports() {
       
   418       return true;
       
   419     }
       
   420   }, {
       
   421     key: "value",
       
   422     get: function get() {
       
   423       return this._currentValue;
       
   424     }
       
   425     /**
       
   426      * Replaces the associated set with a new string value.
       
   427      *
       
   428      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value
       
   429      *
       
   430      * @param {string} value New token set as string.
       
   431      */
       
   432     ,
       
   433     set: function set(value) {
       
   434       value = String(value);
       
   435       this._valueAsArray = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["uniq"])(Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(value.split(/\s+/g)));
       
   436       this._currentValue = this._valueAsArray.join(' ');
       
   437     }
       
   438     /**
       
   439      * Returns the number of tokens.
       
   440      *
       
   441      * @see https://dom.spec.whatwg.org/#dom-domtokenlist-length
       
   442      *
       
   443      * @return {number} Number of tokens.
       
   444      */
       
   445 
       
   446   }, {
       
   447     key: "length",
       
   448     get: function get() {
       
   449       return this._valueAsArray.length;
       
   450     }
       
   451   }]);
       
   452 
       
   453   return TokenList;
       
   454 }();
       
   455 
       
   456 
       
   457 
       
   458 
   403 /***/ })
   459 /***/ })
   404 
   460 
   405 /******/ })["default"];
   461 /******/ })["default"];