-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename detect-disabled.js to detect.js
- Loading branch information
Jake Champion
committed
Sep 25, 2019
1 parent
443e56a
commit 65767d1
Showing
2 changed files
with
32 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'))); |