Skip to content

Instantly share code, notes, and snippets.


Sonishi Izuka sounisi5011

View GitHub Profile
sounisi5011 / dialog-focus-restore.js
Last active Apr 25, 2018 — forked from samthor/dialog-focus-restore.js
Restore focus after a HTML dialog is shown modally
View dialog-focus-restore.js
* Updates the passed dialog to retain focus and restore it when the dialog is closed. Won't
* upgrade a dialog more than once. Supports IE11+ and is a no-op otherwise.
* @param {!HTMLDialogElement} dialog to upgrade
window.registerFocusRestoreDialog = (function() {
var WeakMap = window.WeakMap;
var registered =
typeof WeakMap === 'function'
? new WeakMap()
sounisi5011 / matches-closest.polyfill.js
Last active Feb 12, 2018 — forked from jonathantneal/matchesSelector.polyfill.js
Element.matches & Element.closest Polyfill
View matches-closest.polyfill.js
* @see
* @see
* @see
* @see
var Element;
var ElementPrototype;