Skip to content

Commit

Permalink
Closes #6360: Fix ll bgcss markup (#6362)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miraeld authored Jan 4, 2024
1 parent a253bc5 commit 110e7c6
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion assets/js/lazyload-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function rocket_css_lazyload_launch() {
const usable_pairs = typeof rocket_pairs === 'undefined' ? [] : rocket_pairs;


const styleElement = document.querySelector('#wpr-lazyload-bg');
const styleElement = document.querySelector('#wpr-lazyload-bg-container');

const threshold = rocket_lazyload_css_data.threshold || 300;

Expand Down
2 changes: 1 addition & 1 deletion assets/js/lazyload-css.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/lazyload-css.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inc/Engine/Media/Lazyload/CSS/Front/TagGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function ( $mapping_item ) use ( $loaded ) {
foreach ( $loaded as $item ) {
$loaded_content .= $item['style'];
}
$loaded_tag = "<div id=\"wpr-lazyload-bg\"></div><style id=\"wpr-lazyload-bg-exclusion\">$loaded_content</style>";
$loaded_tag = "<style id=\"wpr-lazyload-bg-container\"></style><style id=\"wpr-lazyload-bg-exclusion\">$loaded_content</style>";

$nostyle_content = '';
foreach ( $mapping as $item ) {
Expand Down
4 changes: 2 additions & 2 deletions src/js/global/lazyload-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function rocket_css_lazyload_launch() {



const styleElement = document.querySelector('#wpr-lazyload-bg');
const styleElement = document.querySelector('#wpr-lazyload-bg-container');

const threshold = rocket_lazyload_css_data.threshold || 300;

Expand All @@ -25,7 +25,7 @@ function rocket_css_lazyload_launch() {
if (pair) {
var new_style_element = document.createElement('style');
new_style_element.textContent = pair.style;
styleElement.appendChild(new_style_element);
styleElement.insertAdjacentElement('afterend', new_style_element);

pair.elements.forEach(el => {
// Stop observing the target element
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$tags = <<<TAG
<div id="wpr-lazyload-bg"></div><style id="wpr-lazyload-bg-exclusion">:root{--wpr-bg-15ef8: url(https://domain.ext/path/to/background.ext); }</style>
<style id="wpr-lazyload-bg-container"></style><style id="wpr-lazyload-bg-exclusion">:root{--wpr-bg-15ef8: url(https://domain.ext/path/to/background.ext); }</style>
<noscript>
<style id="wpr-lazyload-bg-nostyle">:root{--wpr-bg-16ef9: url(https://domain.ext/path/to/background2.ext); }:root{--wpr-bg-17ef6: url(https://domain.ext/path/to/background3.ext); }:root{--wpr-bg-18ef6: url(https://domain.ext/path/to/background3.ext); }</style>
</noscript>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
}
</style> -->
<div id="wpr-lazyload-bg">
</div>
<style id="wpr-lazyload-bg-container">
</style>
<style id="wpr-lazyload-bg-exclusion">
.external-css-background-images{--wpr-bg-15ef8: url('http://example.org/wp-content/rocket-test-data/images/test.png');}.external-css-background-images{--wpr-bg-25ef18: url('http://example.org/wp-content/rocket-test-data/images/paper.jpeg');}.external-css-background-images{--wpr-bg-19ef12: url('https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/styles/./wp-content/rocket-test-data/images/test.png');}</style>
<noscript>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
}
</style> -->
<div id="wpr-lazyload-bg">
</div>
<style id="wpr-lazyload-bg-container">
</style>
<style id="wpr-lazyload-bg-exclusion">
</style>
<noscript>
Expand Down

0 comments on commit 110e7c6

Please sign in to comment.