Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
WalterB-MAMC opened this issue Nov 22, 2023 · 1 comment

Comments

@WalterB-MAMC
Copy link

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
Copy link
Author

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 WalterB-MAMC changed the title Null Exception when checking for Text Starting with 4.2.3 justify-content update breaks the following css (Starting with 4.2.3) Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant