Socket
Socket
Sign inDemoInstall

css-selector-tokenizer

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-selector-tokenizer - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

11

lib/parseValues.js

@@ -26,4 +26,8 @@ "use strict";

function unescapeString(content) {
return content.replace(/\\./g, function(escaped) {
return escaped.substr(1);
return content.replace(/\\([a-fA-F0-9]{4}|.)/g, function(escaped) {
if(escaped.length > 2) {
return String.fromCharCode(parseInt(escaped.substr(1), 16));
} else {
return escaped.substr(1);
}
});

@@ -91,2 +95,3 @@ }

this.root = this.stack.pop();
this.value = this.root.nodes[this.root.nodes.length - 1];
}

@@ -130,3 +135,3 @@ }

"url\\((\\s*)((?:[^\\\\)'\"]|\\\\.)*)(\\s*)\\)": urlMatch,
"(\\w+)\\((\\s*)": nestedItemMatch,
"([\\w\-]+)\\((\\s*)": nestedItemMatch,
"(\\s*)(\\))": nestedItemEndMatch,

@@ -133,0 +138,0 @@ ",(\\s*)": commaMatch,

@@ -5,2 +5,23 @@ "use strict";

function escape(str, stringType) {
return str.replace(/["'\\\x80-\uFFFF]/g, function(match) {
switch(match) {
case "\"":
if(stringType === "\"") {
return "\\\"";
}
return match;
case "'":
if(stringType === "'") {
return "\\'";
}
return match;
case "\\":
return "\\\\";
default:
return "\\" + (0x10000 + match.charCodeAt(0)).toString(16).substr(1);
}
});
}
function stringifyWithoutBeforeAfter(tree) {

@@ -23,5 +44,5 @@ switch(tree.type) {

case "'":
return "'" + tree.value.replace(/'/g, "\\'") + "'";
return "'" + escape(tree.value, "'") + "'";
case "\"":
return "\"" + tree.value.replace(/"/g, "\\\"") + "\"";
return "\"" + escape(tree.value, "\"") + "\"";
}

@@ -28,0 +49,0 @@ /* istanbul ignore next */

{
"name": "css-selector-tokenizer",
"version": "0.5.1",
"version": "0.5.2",
"description": "Parses and stringifies CSS selectors",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc