question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CssSelectorGenerator escapes the selector string

See original GitHub issue

CssSelectorGenerator escapes the selector string.

eg.

3[src='https\3A \/\/site\.com\/folder\/file\.js']

instead of

3[src='https://site.com/folder/file.js']

Is it possible to get the raw (unescaped) selector?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
fczbkkcommented, Sep 7, 2021

I see. So the escaping itself is not a problem. It’s the way the colon character is escaped.

I have checked the code. There is special sequence used for colon. I think it’s for compatibility with old browsers. But I’m not sure, I wrote that part very long ago.

I’ll investigate. But I think I will replace the whole escaping logic with CSS.escape.

1reaction
fczbkkcommented, Sep 8, 2021

The old versions used escaping mechanism that was created to work with old versions of IE. The new version v3.4.3 uses CSS.escape() instead. So there should be no longer special escape sequence used for colon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS.escape() - Web APIs - MDN Web Docs
The CSS.escape() static method returns a string containing the escaped string passed as parameter, mostly for use as part of a CSS selector....
Read more >
CSS escapes
CSS escapes. Wondering how to escape any character in CSS? Learn how, or just use this tool ☺.
Read more >
Use CSS.escape() to escape QuerySelectorAll() - Rick Strahl
To fix this is simple enough: You can use the CSS.escape() function to escape a literal string and encodes any Selector specific characters....
Read more >
Escaping your CSS selectors in the easiest way possible
To prevent errors when selecting these elements they need to be properly escaped to work with any character. At first, I had the...
Read more >
Escapes a string for use within a CSS selector as an identifier
// Use this to escape CSS identifiers that may contain reserved characters. // For example, in JQuery, to select the element whose identifier...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found