postcss-selector-parser
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -0,1 +1,10 @@ | ||
# 6.0.1 | ||
- Fixed an issue with unicode surrogate pair parsing | ||
# 6.0.0 | ||
- Updated: `cssesc` to 3.0.0 (major) | ||
- Fixed: Issues with escaped `id` and `class` selectors | ||
# 5.0.0 | ||
@@ -8,4 +17,4 @@ | ||
- Fixed and issue where comments immediately after an insensitive | ||
(in attribute) were not parsed correctly. | ||
- Fixed an issue where comments immediately after an insensitive (in attribute) | ||
were not parsed correctly. | ||
- Updated `cssesc` to 2.0.0 (major). | ||
@@ -12,0 +21,0 @@ - Removed outdated integration tests. |
@@ -211,2 +211,7 @@ "use strict"; | ||
t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\+o\\+o'); | ||
}); | ||
(0, _helpers.test)('class selector with escaping (34)', '.\\1D306', function (t, tree) { | ||
t.deepEqual(tree.nodes[0].nodes[0].value, '𝌆'); | ||
t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); | ||
t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\1D306'); | ||
}); |
@@ -5,17 +5,17 @@ "use strict"; | ||
exports.default = unesc; | ||
var HEX_ESC = /\\(?:([0-9a-fA-F]{6})|([0-9a-fA-F]{1,5})(?: |(?![0-9a-fA-F])))/g; | ||
var OTHER_ESC = /\\(.)/g; | ||
var whitespace = '[\\x20\\t\\r\\n\\f]'; | ||
var unescapeRegExp = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig'); | ||
function unesc(str) { | ||
str = str.replace(HEX_ESC, function (_, hex1, hex2) { | ||
var hex = hex1 || hex2; | ||
var code = parseInt(hex, 16); | ||
return String.fromCharCode(code); | ||
return str.replace(unescapeRegExp, function (_, escaped, escapedWhitespace) { | ||
var high = '0x' + escaped - 0x10000; // NaN means non-codepoint | ||
// Workaround erroneous numeric interpretation of +"0x" | ||
// eslint-disable-next-line no-self-compare | ||
return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint | ||
String.fromCharCode(high + 0x10000) : // Supplemental Plane codepoint (surrogate pair) | ||
String.fromCharCode(high >> 10 | 0xd800, high & 0x3ff | 0xdc00); | ||
}); | ||
str = str.replace(OTHER_ESC, function (_, char) { | ||
return char; | ||
}); | ||
return str; | ||
} | ||
module.exports = exports.default; |
{ | ||
"name": "postcss-selector-parser", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"devDependencies": { | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.3.3", | ||
"@babel/plugin-proposal-class-properties": "^7.3.3", | ||
"@babel/preset-env": "^7.3.1", | ||
"@babel/core": "^7.3.4", | ||
"@babel/plugin-proposal-class-properties": "^7.3.4", | ||
"@babel/preset-env": "^7.3.4", | ||
"@babel/register": "^7.0.0", | ||
"ava": "^1.2.1", | ||
"ava": "^1.3.1", | ||
"babel-eslint": "^10.0.1", | ||
@@ -15,3 +15,3 @@ "babel-plugin-add-module-exports": "^1.0.0", | ||
"del-cli": "^1.1.0", | ||
"eslint": "^5.14.1", | ||
"eslint": "^5.15.1", | ||
"eslint-plugin-babel": "^5.3.0", | ||
@@ -18,0 +18,0 @@ "eslint-plugin-import": "^2.16.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
303516
6156