Commit b4691f52 authored by Tim Zallmann's avatar Tim Zallmann

Moving StartupCSS onload event handlers

Moved to inline script tag instead of inline event handlers
parent 5db770df
......@@ -237,7 +237,7 @@ module ApplicationHelper
def stylesheet_link_tag_defer(path)
if use_startup_css?
stylesheet_link_tag(path, media: "print", onload: "this.onload=null;this.media='all'")
stylesheet_link_tag(path, media: "print")
else
stylesheet_link_tag(path, media: "all")
end
......
......@@ -57,10 +57,12 @@
- else
= stylesheet_link_tag_defer "application"
= 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}"
= render 'layouts/startup_css'
= Gon::Base.render_data(nonce: content_security_policy_nonce)
- 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