Comments (3)
Both cssesc
and CSS.escape
are JavaScript functions that are used to escape special characters in CSS strings. However, there are some differences between them.
cssesc
is a third-party library that provides a more comprehensive set of escape sequences than CSS.escape
. cssesc
can escape a wider range of characters, including control characters, Unicode characters, and invalid CSS identifiers. It also offers more configuration options, such as specifying the character encoding or the style of the escape sequence.
On the other hand, CSS.escape
is a built-in function that was introduced in the CSS Object Model (CSSOM) specification. It is designed specifically for escaping CSS identifiers and can handle only ASCII characters. CSS.escape
is intended to be used in environments where the CSSOM is available, such as in a browser environment.
In most cases, CSS.escape
should be sufficient for escaping CSS identifiers in a browser environment. However, if you need to escape a wider range of characters or if you're working outside of a browser environment, you may want to consider using cssesc
.
In terms of whether it's possible to replace cssesc
with CSS.escape
, it depends on the specific use case. If you only need to escape ASCII characters in a browser environment, then you can use CSS.escape
instead of cssesc
. However, if you need to escape a wider range of characters or if you're working outside of a browser environment, then you will need to use cssesc
.
from finder.
https://caniuse.com/mdn-api_css_escape Probably we can do the switch.
from finder.
I see, thanks for your answer!
from finder.
Related Issues (20)
- [Feature request] Ability to prioritize certain attributes over keeping the selectors as short as possible. HOT 5
- The execution speed is relatively slow HOT 4
- Consider caching/memoizing "unique" function HOT 2
- Selector not found HOT 1
- CDN Stopped working HOT 3
- Selector was not found for all the elements on page
- Selector not found HOT 6
- Argument of type 'Node' is not assignable to parameter of type 'Element'. HOT 1
- [feature request] - generation of 'alternate' selector HOT 3
- [feature request] Add config option to include structural/semantic elements HOT 7
- Prefer `[id="123"]` vs. `#\31 23` HOT 1
- Support multiple elements HOT 4
- root config doesn't allow Document HOT 1
- Uncompiled `finder.ts` file is a target of compilation by typescript HOT 1
- Finder Timeout HOT 2
- Support for XML namespace prefixes in DOM Element names / tagnames (XHTML, SVG, MathML), with proposed fix HOT 1
- Thought out loud - Chrome Extension
- [Feature Request] find path for multiple elements and find closest common parent HOT 2
- [Bug] Potential memory exhaustion when a high number of classes exist at multiple levels in the DOM HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finder.