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

removeClass() in some cases changes the order of classes #214

Open
mezorian opened this issue Jan 11, 2021 · 1 comment
Open

removeClass() in some cases changes the order of classes #214

mezorian opened this issue Jan 11, 2021 · 1 comment

Comments

@mezorian
Copy link

mezorian commented Jan 11, 2021

Hi, first of all thank you for your great tool!
I really like to have this as a python library :)

During some of my unit-tests I discovered some behavior of the removeClass() function.
While converting the result of tag.get() into a python set at

it might happen that the order of values is changed.
I think the reason for this is that regarding to

a set is a

unordered

collection which means that

items can appear in a different order every time you use them

AFAIK css classes are also defined as unordered (see : https://css-tricks.com/the-order-of-css-classes-in-html-doesnt-matter/ )
Maybe there are other opinions here and I open to a short discussion, but I personally would expect this function to only remove the specified class and keep the order as it is.

To give you an idea where this could be relevant, I can try to explain you why this is an issue for my unit-tests.
I have written a small framework which in the end is generating some html reports to show if everything was successful or if there were any issues. To test this html generation I have unit-tests which call my framework and which compare the generated html with some expected html. In most of the cases these tests are successful, but sometimes the generated html differs in the order of classes. Always when this happens the comparison considers the two files as not equal and fails.

If you agree that this is unexpected behavior I am also open to try to fix this.
To be honest I am not yet super experienced in python, but I think with some small info on how to build and test everything I could maybe manage this ;)

BR, mezorian

@gawel
Copy link
Owner

gawel commented Jan 11, 2021

Hi,

yes, it's definitely a bug

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

2 participants