UNPKG

webdav-js

Version:

WebDAV functionality intended for use as a bookmarklet or to make a simple webserver an interactive WebDAV environment.

17 lines (11 loc) 489 B
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;