UNPKG

1.51 kBJavaScriptView Raw
1/**
2@license
3Copyright (c) 2020 The Polymer Project Authors. All rights reserved.
4This code may only be used under the BSD style license found at
5http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
6http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
7found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
8part of the polymer project is also subject to an additional IP rights grant
9found at http://polymer.github.io/PATENTS.txt
10*/
11const Element_prototype = window.Element.prototype;
12const HTMLElement_prototype = window.HTMLElement.prototype;
13const SVGElement_prototype = window['SVGElement'].prototype;
14// Thanks to @justinfagnani for finding this:
15//
16// In IE11, `classList` is only supported on `HTMLElement` instances: the
17// descriptor is an own property of `HTMLElement.prototype` and is an accessor
18// descriptor with `set` as `undefined` and no `get`. However, it seems to be
19// implemented generically enough such that copying it to something in the
20// prototype chain of `SVGElement` correctly adds support for `classList` (as
21// far as `DOMTokenList` implemented in IE11).
22if (HTMLElement_prototype.hasOwnProperty('classList') &&
23 !Element_prototype.hasOwnProperty('classList') &&
24 !SVGElement_prototype.hasOwnProperty('classList')) {
25 Object.defineProperty(Element_prototype, 'classList', Object.getOwnPropertyDescriptor(HTMLElement_prototype, 'classList'));
26}
27//# sourceMappingURL=svg-element-class-list.js.map
\No newline at end of file