Commit 85825fb1 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'tz-startup-non-inline-event-handlers' into 'master'

Startup.CSS: Move onload handlers to inline Script Tag

See merge request gitlab-org/gitlab!38767
parents d71eee8a b4691f52
...@@ -237,7 +237,7 @@ module ApplicationHelper ...@@ -237,7 +237,7 @@ module ApplicationHelper
def stylesheet_link_tag_defer(path) def stylesheet_link_tag_defer(path)
if use_startup_css? if use_startup_css?
stylesheet_link_tag(path, media: "print", onload: "this.onload=null;this.media='all'") stylesheet_link_tag(path, media: "print")
else else
stylesheet_link_tag(path, media: "all") stylesheet_link_tag(path, media: "all")
end end
......
...@@ -57,10 +57,12 @@ ...@@ -57,10 +57,12 @@
- else - else
= stylesheet_link_tag_defer "application" = stylesheet_link_tag_defer "application"
= stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations'] = stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations']
= stylesheet_link_tag 'performance_bar' if performance_bar_enabled? = stylesheet_link_tag_defer 'performance_bar' if performance_bar_enabled?
= stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}" = stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}"
= render 'layouts/startup_css'
= Gon::Base.render_data(nonce: content_security_policy_nonce) = Gon::Base.render_data(nonce: content_security_policy_nonce)
- if content_for?(:library_javascripts) - if content_for?(:library_javascripts)
......
- return unless use_startup_css?
= javascript_tag nonce: true do
:plain
document.querySelectorAll('link[media="print"]').forEach(linkTag => {
linkTag.addEventListener('load', function() {this.media='all'}, {once: true});
})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment