ExCSS icon indicating copy to clipboard operation
ExCSS copied to clipboard

justify-content update breaks the following css (Starting with 4.2.3)

Open WalterB-MAMC opened this issue 2 years ago • 1 comments

In the code snippet below, it has worked for a few versions back, but once I upgrade to 4.2.3 this code blows up with a null exception error and it says that .Text is null. I could not even check if it was null many different ways. Was Text changed to something else that I should be using to compare or is this a bug? Is there a better way to do this?

I am checking the classes and properties sets to see if they are different, if they are then I modify them and then further down I just extract the class and the properties that are different out to make a smaller file of the differences. This way I can extract all the same code out of a theme CSS file to be only the color differences for the most part and add data-bs tags so I can easily flip between say light and dark themes in Bootstrap format. Like I said this has been working up until 4.2.3. Not sure why it breaks in that version and above.

var css1Rules = stylesheet1.StyleRules;
var css2Rules = stylesheet2.StyleRules;

var bothRules = css1Rules.Zip(css2Rules, (r1, r2) => new { Rule1 = r1, Rule2 = r2 });

foreach (var rule in bothRules)
{
     if (rule.Rule2.Text != rule.Rule1.Text)
     {
        //do checks and stuff
     }

}

WalterB-MAMC avatar Nov 22 '23 20:11 WalterB-MAMC

I tracked down the CSS that makes this break starting with 4.2.3.

.justify-content-first-baseline {
    justify-content: first baseline;
}

.\!justify-content-first-baseline {
    justify-content: first baseline !important;
}

.justify-content-last-baseline {
    justify-content: last baseline;
}

.\!justify-content-last-baseline {
    justify-content: last baseline !important;
}

The changes made in the code to "fix" justify content broke this. This will parse with the code in the OP but throws a NullReferenceException in 4.2.3 or greater. This code is provided by a library and not code I am generating so its not something that I can just change and move on. I parse two CSS files and look for the differences and create a diff CSS file. Can no longer do this with the newer versions as they crash now. Any help would be great!

WalterB-MAMC avatar Jan 25 '24 06:01 WalterB-MAMC