Print skip-link-focus-fix inline instead of enqueueing as blocking script #1323
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request:
Enqueueing scripts is very costly since the browser will block rendering until the script is loaded. What's more is that it is only applicable in IE11, so it is particularly bad to have this blocking script loaded for 90% of browsers which will never use it. (If IE11 supported conditional comments, those could have been used here, but it does not.) Blocking scripts should be minimized as much as possible, either by adding the
async
attribute or by outputting thescript
inline.While core doesn't yet have built-in support for
async
, core does currently add an inline script for adding the emoji logic (print_emoji_detection_script()
/_print_emoji_detection_script()
). A similar approach is proposed here for theskip-link-focus-fix
script. Just like for the emoji detection script, the skip-link-focus-fix is small in size and it is only applicable to IE11.Related issue(s):
#1206