Closed SebastianStehle closed 2 years ago
Also, please add a new section to the changelog.md at the top that looks a bit like this:
# 0.18.0
Released on ??, ??, 2022.
- Added <WRITE DESCRIPTION OF ADDITION HERE>. By [@SebastianStehle](https://github.com/SebastianStehle).
To round things off, it would be fantastic if you could write a small section for the wiki on this new feature that goes below this one: https://github.com/AngleSharp/AngleSharp.Diffing/wiki/Diffing-Options#style-attribute-comparer
Just add it here as a comment and I will move it to the WIKI when this is merged.
I have implemented your change requests.
Here is what I would add to the wiki:
When styles are parsed they are also normalized. This means that the following styles would be identical:
style="border: 1px solid red;"
style="border: solid 1px red;"
But if you have multiple styles the order matters and is therefore not changed. The following styles are different:
style="color: red; border: 0"
style="border: 0; color: red"
To add a style comparer where the order does not matter you can register the style comparer with the optional parameter ignoreOrder=true
:
var diffs = DiffBuilder
.Compare(controlHtml)
.WithTest(testHtml)
.WithOptions(options => options.AddStyleAttributeComparer(ignoreOrder: true))
.Build();
@FlorianRappl does the version scheme for AngleSharp projects allow us to make breaking changes while only going from 0.17.0 to 0.18.0?
Technically, adding the extra parameter ignoreOrder
to AddStyleAttributeComparer(ignoreOrder: true)
is consider a breaking change by Microsoft.
Does the version scheme for AngleSharp projects allow us to make breaking changes while only going from 0.17.0 to 0.18.0?
Well, in general we advise to keep everything at the same base level to indicate compatibility with AngleSharp.Core
, however, here it seems we are anyway not aligned. Maybe let's re-align with AngleSharp v1.0?
In any case yes, adding an additional parameter (or modifying a signature) is unfortunately breaking in C#. If that is not desired my advise would be to add a new method instead of making the overload - thus introducing no breaking change. (However, as stated I personally have no objection against breaking changes / going to 0.18 or whatever right now).
Maybe let's re-align with AngleSharp v1.0?
Yes. Lets do that. I will keep the overload in this case as it makes more sense to me. After AngleSharp reaches v1 we can switch a more proper use of semantic versioning and align all projects on that.
Types of Changes
Prerequisites
Please make sure you can check the following two boxes:
Contribution Type
What types of changes does your code introduce? Put an
x
in all the boxes that apply:Description
Closes #17
I am not happy with the implementation. It sucks that I have to make the Split, but it should not matter, because the library is usually not used in performance critical scenarios I guess.
Because the csstext seems to be normalized it should work fine.