Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/5615'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Feb 5, 2025
2 parents 51dab65 + 3dda236 commit 75606ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/initializers/sanitize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Sanitize::Config::RELAXED,
:elements => Sanitize::Config::RELAXED[:elements] - %w[div style],
:remove_contents => %w[script style],
:attributes => Sanitize::Config.merge(
Sanitize::Config::RELAXED[:attributes],
"img" => Sanitize::Config::RELAXED[:attributes]["img"] + ["loading"]
),
:transformers => lambda do |env|
style = env[:node]["style"] || ""

Expand All @@ -24,5 +28,7 @@

env[:node]["rel"] = rel.split.select { |r| r == "me" }.append("nofollow", "noopener", "noreferrer").sort.join(" ")
end

env[:node]["loading"] = "lazy" if env[:node_name] == "img"
end
)

0 comments on commit 75606ab

Please sign in to comment.