Skip to content

Commit

Permalink
Boost: Update defer js to skip JSON-LD schemas (#35417)
Browse files Browse the repository at this point in the history
* Update defer js to skip JSON-LD schemas

* add changelog
  • Loading branch information
dilirity authored and spsiddarthan committed Feb 15, 2024
1 parent 6eb9ebb commit 08e0e82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ protected function ignore_exclusion_scripts( $buffer ) {
'~<!--.*?-->~si',

// Scripts with types that do not execute complex code. Moving them down can be dangerous
// and does not benefit performance. Includes types: application/json and importmap.
'~<script\s+[^\>]*type=(?<q>["\']*)(application/json|importmap)\k<q>.*?>.*?</script>~si',
// and does not benefit performance. Includes types: application/json, application/ld+json and importmap.
'~<script\s+[^\>]*type=(?<q>["\']*)(application\/(ld\+)?json|importmap)\k<q>.*?>.*?<\/script>~si',
);

return preg_replace_callback(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Defer JS: Skip JSON-LD schemas.

0 comments on commit 08e0e82

Please sign in to comment.