Skip to content

Commit

Permalink
Update and rename detect-disabled.js to detect.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Champion committed Sep 25, 2019
1 parent 443e56a commit 65767d1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
25 changes: 0 additions & 25 deletions polyfills/Event/focusin/detect-disabled.js

This file was deleted.

32 changes: 32 additions & 0 deletions polyfills/Event/focusin/detect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* The detect and tests for the focusin/focusout polyfill have been shown to not work reliably.
* See https://github.com/Financial-Times/polyfill-service/issues/213 for details.
* The polyfill itself appears to work fine, but events programmatically fired during page load
* while dev tools is open appear not to be observable by the polyfill, which makes the test and
* detect unreliable. We're continuing to serve the polyfill as it's pretty simple but would
* love to get some better insight into this problem.
*/

(function(support, html, a) {
if ('onfocusin' in window) {
return true;
}

function onfocusin() {
support = true;
}

a.href = '#';

if ('addEventListener' in a) {
a.addEventListener('focusin', onfocusin);
} else {
a.attachEvent('onfocusin', onfocusin);
}

html.appendChild(a).focus();

html.removeChild(a);

return support;
}(false, document.documentElement, document.createElement('a')));

0 comments on commit 65767d1

Please sign in to comment.