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

Bug: Replaces new lines with "A" character and makes CSS selector invalid #44

Open
turgutsaricam opened this issue Feb 13, 2019 · 2 comments

Comments

@turgutsaricam
Copy link

turgutsaricam commented Feb 13, 2019

In utilities.js line 39, .replace(/\n/g, '\A') replaces new line characters with A character. Replacement part should be \\A. This bug causes CSS selectors to be invalid. For example, if an element has many classes separated by new lines, this adds .A selector for each new line. For instance, if class attribute of an element is class1\n class2\n class3, produced CSS selector is .class1A.class2A.class3, where it should be .class1.class2.class3

@turgutsaricam turgutsaricam changed the title Replaces new lines with "A" character and makes CSS selector invalid Bug: Replaces new lines with "A" character and makes CSS selector invalid Feb 13, 2019
@autarc
Copy link
Owner

autarc commented Feb 13, 2019

Thanks for bringing up the issue. It will be tackled along with some other improvements in an upcoming release!

@spiderman22
Copy link

@turgutsaricam hey, just encountered this also.
But, changing this to \A didn't work for me - I am getting the selector of the element using this lib, but after then, trying to find it with document.querySelector(). And when adding \A, it is not workig properly.

Should the fix be replace \n with nothing?

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

3 participants