Skip to content

Check for pre existing inline styling rules before inserting plugin related styling #658

@jamesozzie

Description

@jamesozzie

Bug Description

As raised by one user in the support forums, in cases whereby third party plugins or WordPress core have existing inline styling added to elements of their site, without closing these rules (via a ; suffix), the Performance Lab plugin will insert it's own styling (ie. dominant color styling: --dominant-color: #736e5e;) merged in place with existing rules. This results in the dominant color styling not applying (along with the third party plugins inline styling).

While this isn't specifically a Performance Lab issue, to improve the likelihood of this happening, consider checking for pre-existing inline styling rules when inserting the dominant color and any other inline styling. If there is inline styling added via other means, check whether they are closed. If not, include a prefix ; to the dominant color styling.

Steps to reproduce

  1. Add a cover block to a WordPress post
  2. To ensure there is inline styling added, change the "Focal Point Picker", as per this recording. In this case, the inline styling will appear similar to: style="object-position:22% 59%"
  3. Check your sites source code, notice the inline styling isn't closed (doesn't have a semi colon)
  4. Enable the "Dominants Color module" within the Performance Lab configurations
  5. Notice that the styling added via the dominant color is merged with the Cover block styling, rendering both redundant

Screenshots

Below: Example of inline styling with the Cover block - notice there is no closing semi colon:

image

Below: Example of inline styling with the Cover block, with another plugin that also adds it's own inline styling to the same element - there is no distinction between the rules, they're merged.

image

Additional Context

Metadata

Metadata

Labels

[Plugin] Image PlaceholdersIssues for the Image Placeholders plugin (formerly Dominant Color Images)[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin only[Type] BugAn existing feature is broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions