optimal-select icon indicating copy to clipboard operation
optimal-select copied to clipboard

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

Open turgutsaricam opened this issue 6 years ago • 2 comments

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 avatar Feb 13 '19 06:02 turgutsaricam

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

autarc avatar Feb 13 '19 22:02 autarc

@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?

spiderman22 avatar Apr 01 '20 14:04 spiderman22