Bug: CSS Manager Pollutes DOM


#1

The CSS manager module is creating a new style object for every entry it wants to make for the style generation.
Below is a screenshot that shows this. Notice how there are multiple style elements with the id “dhx_generated_styles”, and each has only 1 CSS declaration.

image

I think the intent was to have 1 element with multiple lines in it like this:
<style id=“dhx_generated_styles”>
.dhx_cell-style__u1620936263035{ flex:0 0 auto; }
.dhx_cell-style__u1620936263036{ flex:0 0 auto; }
.dhx_cell-style__u1620936263037{ flex:0 0 auto; }
.dhx_cell-style__u1620936263040{ flex:0 0 auto; padding:6px; }
.dhx_cell-style__u1620936263041{ flex:0 0 auto; padding:6px; }
.dhx_cell-style__u1620936263042{ flex:0 0 auto; padding:6px; }
.dhx_cell-style__u1620936263038{ flex:0 0 auto; }
.dhx_cell-style__u1620936263045{ flex:0 0 auto; padding:6px; }
.dhx_cell-style__u1620936263046{ flex:0 0 auto; padding:6px; }
.dhx_cell-style__u1620936263047{ flex:0 0 auto; padding:6px; }
.dhx_cell-style__u1620936263043{ flex:0 0 auto; }
.dhx_cell-style__u1620936263033{ width:100%; height:100%; flex:1 1 auto; padding:8px; }
</style>


#2

Hi,

Thanks for reporting!
I’ve submitted the bug to our tracker, so it will be fixed eventually, but I can’t give you any timeline yet.


#3

Hi @Kade333 !

We’re currently investigating this bug and so far are unable to reproduce it.

Here is a snippet we use:
https://snippet.dhtmlx.com/sli2kcu0

When I inspect the contents of “Preview” tab, I can see only one .dhx_generated_styles element.

Can you please advise on how to reproduce the issue? It would help a lot if you could provide some code samples, or you can modify and update the online snippet from this message, so it would demonstrate the issue.


#4

Looks like it used to be used in version 7.1.2- but the methods using it have been removed in version 7.1.9.

The class “Cell” was creating a new CssManager instance for each cell (instead of sharing the same one)- which is what caused the DOM pollution to happen.