Skip to content

Commit

Permalink
do not add crossorigin or integrity to <link> when self-hosting
Browse files Browse the repository at this point in the history
  • Loading branch information
mlwilkerson committed Nov 28, 2024
1 parent f8af49b commit a09b701
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions includes/class-fontawesome-svg-styles-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,16 @@ public function register_svg_styles( $fa, $fa_release_provider ) {
'style_loader_tag',
function ( $html, $handle ) use ( $integrity_key, $load_mode ) {
if ( in_array( $handle, array( self::RESOURCE_HANDLE_SVG_STYLES ), true ) ) {
$crossorigin_attr = 'selfhost' === $load_mode
? '' : ' crossorigin="anonymous"';
if ( 'selfhost' === $load_mode ) {
/**
* If self-hosting:
* - do not add the integrity key because it may conflict with CSS bundling optimizations.
* - do not add crossorigin because it is not needed for same-origin stylesheets.
*/
return $html;
}

$crossorigin_attr = ' crossorigin="anonymous"';

$integrity_attr = "integrity=\"$integrity_key\"";

Expand Down

0 comments on commit a09b701

Please sign in to comment.