File: src/lib/supportsEvent.ts

Recommend this page to a friend!
  Classes of Dom Hastings   JS Webdav Client   src/lib/supportsEvent.ts   Download  
File: src/lib/supportsEvent.ts
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: JS Webdav Client
Access files of a Webdav server
Author: By
Last change:
Date: 7 months ago
Size: 489 bytes


Class file image Download
const testElement = document.createElement('span'); export const supportsEvents = (...eventNames: string[]): boolean => eventNames.every((eventName) => supportsEvent(eventName)); export const supportsEvent = (eventName: string): boolean => { const attributeName = `on${eventName}`; if (!testElement.hasAttribute(attributeName)) { testElement.setAttribute(attributeName, ''); } return typeof testElement[`on${eventName}`] === 'function'; }; export default supportsEvent;