We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ontoggle
Hello!
This code adds a support of the ontoggle event handler in Safari, which lacks this feature:
{ const { HTMLElement : { prototype } } = window; if(!('ontoggle' in prototype)) { Object.defineProperties(prototype, { ontoggle : { configurable : true, enumerable : true, set(handler) { this.__handler_ontoggle__ = typeof handler === 'function'? handler.bind(this) : null; }, get() { return this.__handler_ontoggle__; } }, __handler_ontoggle__ : { writable : true, value : null } }); document.addEventListener('toggle', event => { const target = event.target; if(typeof target.ontoggle) target.ontoggle(event); }, true); } }
Usage:
const details = document.createElement('details'); details.ontoggle(handler);
I don't know CoffeeScript, sorry. And thanks for this stuff!
The text was updated successfully, but these errors were encountered:
According to caniuse, the latest version of Safari 10.1 does not have this issue any more. I haven't tested it myself.
Sorry, something went wrong.
No branches or pull requests
Hello!
This code adds a support of the ontoggle event handler in Safari, which lacks this feature:
Usage:
I don't know CoffeeScript, sorry.
And thanks for this stuff!
The text was updated successfully, but these errors were encountered: