User tests: Successful: Unsuccessful:
Pull Request for Issue #27163.
Fixes inline assets in module with Progressive Caching enabled.
Add some inline scripts and styles to a module:
$app->getDocument()->addStyleDeclaration('* {background:white !important;');
$app->getDocument()->addStyleDeclaration('* {background:black !important;');
$app->getDocument()->addStyleDeclaration('* {color:white !important;}');
$app->getDocument()->addStyleDeclaration('* {color:white !important;}');
$app->getDocument()->addScriptDeclaration('alert(1);');
$app->getDocument()->addScriptDeclaration('alert(2);');
$app->getDocument()->addScriptDeclaration('alert(1);');
$app->getDocument()->addScriptDeclaration('alert(2);');
Enable Progressive Caching.
View some page twice to generate cache and to load cached data.
No warnings.
The added styles/scripts are working correctly.
Duplicated scripts/styles do not appear in source code (e.g. script with alert(1);
only appears once).
Scripts/styles don't work and warnings are generated:
Warning: md5() expects parameter 1 to be string, array given in libraries\src\Document\Document.php on line 676
Warning: stristr() expects parameter 1 to be string, array given in libraries\src\Document\HtmlDocument.php on line 338
No.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Rel_Number | ⇒ | 27163 | |
Relation Type | ⇒ | Pull Request for | |
Labels |
Added:
?
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-09 10:30:49 |
Closed_By | ⇒ | wilsonge |
Thanks!
I have tested this item✅ successfully on b5b4392
I put the suggested styles and scripts into the Breadcrumbs module. Without the patch the changes worked once but disappeared on subsequent page loads. With the patch it worked as expected every time.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28990.