dist/event-target-shim.js
function defineEventAttributeDescriptor(eventName) {
    return {
        get() {
            const listeners = getListeners(this);
            let node = listeners.get(eventName);
            while (node != null) {
                if (node.listenerType === ATTRIBUTE) {
                    return node.listener
                }
                node = node.next;
            }
            return null
        },

        set(listener) {
            if (typeof listener !== "function" && !isObject(listener)) {
                listener = null; // eslint-disable-line no-param-reassign
            }
            const listeners = getListeners(this);

            // Traverse to the tail while removing old value.
            let prev = null;
            let node = listeners.get(eventName);
            while (node != null) {
                if (node.listenerType === ATTRIBUTE) {
                    // Remove old value.
                    if (prev !== null) {
                        prev.next = node.next;
                    } else if (node.next !== null) {
                        listeners.set(eventName, node.next);
                    } else {
                        listeners.delete(eventName);
                    }
                } else {
                    prev = node;
                }

                node = node.next;
            }

            // Add new value.
            if (listener !== null) {
                const newNode = {
                    listener,
                    listenerType: ATTRIBUTE,
                    passive: false,
                    once: false,
                    next: null,
                };
                if (prev === null) {
                    listeners.set(eventName, newNode);
                } else {
                    prev.next = newNode;
                }
            }
        },
        configurable: true,
        enumerable: true,
    }
}
function defineEventAttributeDescriptor(eventName) {
    return {
        get() {
            const listeners = getListeners(this);
            let node = listeners.get(eventName);
            while (node != null) {
                if (node.listenerType === ATTRIBUTE) {
                    return node.listener
                }
                node = node.next;
            }
            return null
        },

        set(listener) {
            if (typeof listener !== "function" && !isObject(listener)) {
                listener = null; // eslint-disable-line no-param-reassign
            }
            const listeners = getListeners(this);

            // Traverse to the tail while removing old value.
            let prev = null;
            let node = listeners.get(eventName);
            while (node != null) {
                if (node.listenerType === ATTRIBUTE) {
                    // Remove old value.
                    if (prev !== null) {
                        prev.next = node.next;
                    } else if (node.next !== null) {
                        listeners.set(eventName, node.next);
                    } else {
                        listeners.delete(eventName);
                    }
                } else {
                    prev = node;
                }

                node = node.next;
            }

            // Add new value.
            if (listener !== null) {
                const newNode = {
                    listener,
                    listenerType: ATTRIBUTE,
                    passive: false,
                    once: false,
                    next: null,
                };
                if (prev === null) {
                    listeners.set(eventName, newNode);
                } else {
                    prev.next = newNode;
                }
            }
        },
        configurable: true,
        enumerable: true,
    }
}
function defineEventAttributeDescriptor ( eventName ) { return { get ( ) { const listeners = getListeners ( this ) ; let node = listeners . get ( eventName ) ; while ( node != null ) { if ( node . listenerType === ATTRIBUTE ) { return node . listener } node = node . next ; } return null } , set ( listener ) { if ( typeof listener !== "function" && ! isObject ( listener ) ) { listener = null ; // eslint-disable-line no-param-reassign } const listeners = getListeners ( this ) ; // Traverse to the tail while removing old value. let prev = null ; let node = listeners . get ( eventName ) ; while ( node != null ) { if ( node . listenerType === ATTRIBUTE ) { // Remove old value. if ( prev !== null ) { prev . next = node . next ; } else if ( node . next !== null ) { listeners . set ( eventName , node . next ) ; } else { listeners . delete ( eventName ) ; } } else { prev = node ; } node = node . next ; } // Add new value. if ( listener !== null ) { const newNode = { listener , listenerType : ATTRIBUTE , passive : false , once : false , next : null , } ; if ( prev === null ) { listeners . set ( eventName , newNode ) ; } else { prev . next = newNode ; } } } , configurable : true , enumerable : true , } }
Get the property descriptor for the event attribute of a given event.
@param {string} eventName The event name to get property descriptor.
@returns {PropertyDescriptor} The property descriptor.
@private
Get the property descriptor for the event attribute of a given event .