Problem/Motivation

The collection renderer service provided by the module has the potential to render empty <style> tags in unexpected places. For example, after enabling the module with big_pipe also enabled, the action attribute on forms is broken.

Example

/admin/modules/uninstall/confirm" method="post" id="system-modules-uninstall-confirm-form" accept-charset="UTF-8">

is added to the attribute action

Replicated with

PHP 8.0.12
Drupal 9.3.3

Proposed solution

The solution should be simple: prevent the asset collection renderer from writing a <style> element into the DOM response if there are no styles to render.

CommentFileSizeAuthor
#5 3260744-5-test-only.patch2.89 KBluke.leber
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

proweb.ua created an issue. See original summary.

luke.leber’s picture

Priority: Normal » Critical

Hi, sorry to hear you're having issues. The good news is that I'm able to replicate this.

I'm promoting the issue priority to critical.

luke.leber’s picture

I believe that this has something to do with the big_pipe module. Are you able to test out uninstalling big_pipe on a development environment to confirm? In the meantime, I'll see what I can do to resolve the conflict.

Thanks!

luke.leber’s picture

Title: All forms is broken » Empty style tags may be erroneously injected into markup
Issue summary: View changes
luke.leber’s picture

StatusFileSize
new2.89 KB

Uploaded test-only patch that should fail.

luke.leber’s picture

Version: 1.0.0-rc2 » 1.0.x-dev

luke.leber’s picture

Status: Active » Needs review

The current merge request should resolve the issue at hand.

I'll wait a few days for affirmative feedback from the community before merging the solution in and cutting a new release.

@proweb.ua - thanks so much for your bug report!

proweb.ua’s picture

#5 applied to dev version

is not added to forms now.

But I also don't see inline css.
Cleared the cache. Advagg enabled / disabled.

luke.leber’s picture

luke.leber’s picture

I've opened https://www.drupal.org/project/inline_all_css/issues/3260846 as a related issue here.

I think that what you're running into is that the head of the dev version adds an additional configuration option to enable / disable the inline behavior. When I committed that feature, I did neglect to provide an update hook to auto-enable things for users that had already installed the module.

If you check the 'enable' box under Configuration -> System -> Inline all css configuration, do things seem to work?

Thanks for bearing with me on this.

  • Luke.Leber committed 6f6279f on 1.0.x
    Issue #3260744 by Luke.Leber, proweb.ua: Empty style tags may be...
luke.leber’s picture

Status: Needs review » Fixed

Committed and pushed to 1.0.x! Thanks for the bug report.

I'll be landing https://www.drupal.org/project/inline_all_css/issues/3260846 this weekend and cutting rc3.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.