lib/polyfills/class-list.js
function applyPolyfill(ElementClass) {
  if (ElementClass.prototype.hasOwnProperty('classList')) {
    return;
  }

  Object.defineProperty(ElementClass.prototype, 'classList', {
    get: lazyDefinePropertyValue('classList', function() {
      if (!(this instanceof ElementClass)) {
        throw new Error(
            '\'get classList\' called on an object that does not implement interface Element.');
      }
      return new DOMTokenList(this, 'className');
    }),
    set: throwError('classList property is read-only'),
    enumerable: true,
    configurable: true,
  });
}
function applyPolyfill(ElementClass) {
  if (ElementClass.prototype.hasOwnProperty('classList')) {
    return;
  }

  Object.defineProperty(ElementClass.prototype, 'classList', {
    get: lazyDefinePropertyValue('classList', function() {
      if (!(this instanceof ElementClass)) {
        throw new Error(
            '\'get classList\' called on an object that does not implement interface Element.');
      }
      return new DOMTokenList(this, 'className');
    }),
    set: throwError('classList property is read-only'),
    enumerable: true,
    configurable: true,
  });
}
function applyPolyfill ( ElementClass ) { if ( ElementClass . prototype . hasOwnProperty ( 'classList' ) ) { return ; } Object . defineProperty ( ElementClass . prototype , 'classList' , { get : lazyDefinePropertyValue ( 'classList' , function ( ) { if ( ! ( this instanceof ElementClass ) ) { throw new Error ( '\'get classList\' called on an object that does not implement interface Element.' ) ; } return new DOMTokenList ( this , 'className' ) ; } ) , set : throwError ( 'classList property is read-only' ) , enumerable : true , configurable : true , } ) ; }
Checks if prototype of passed ElementClass contains classList and,
in case not, creates a polyfill implementation.
Checks if prototype of passed ElementClass contains classList and in case not creates a polyfill implementation .