carbon-custom-elements
Version:
A Carbon Design System variant that's as easy to use as native HTML elements, with no framework tax, no framework silo.
1 lines • 819 B
Source Map (JSON)
{"version":3,"sources":["polyfills/toggle-attribute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG","file":"toggle-attribute.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (!Element.prototype.toggleAttribute) {\n Element.prototype.toggleAttribute = function toggleAttribute(name: string, force?: boolean) {\n const oldState = Boolean(this.hasAttribute(name));\n const newState = typeof force !== 'undefined' ? Boolean(force) : !oldState;\n if (oldState !== newState) {\n if (newState) {\n this.setAttribute(name, '');\n } else {\n this.removeAttribute(name);\n }\n }\n return newState;\n };\n}\n"]}