css-what
Advanced tools
Comparing version 3.2.0 to 3.2.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = parse; | ||
var reName = /^(?:\\.|[\w\-\u00b0-\uFFFF])+/, reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi, | ||
var reName = /^(?:\\([\da-f]{1,6}\s?|(\s)|.)|[\w\-\u00b0-\uFFFF])+/, reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi, | ||
//modified version of https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L87 | ||
@@ -6,0 +6,0 @@ reAttr = /^\s*((?:\\.|[\w\u00b0-\uFFFF-])+)\s*(?:(\S?)=\s*(?:(['"])([^]*?)\3|(#?(?:\\.|[\w\u00b0-\uFFFF-])*)|)|)\s*(i)?\]/; |
@@ -35,20 +35,20 @@ "use strict"; | ||
if (token.type === "attribute") { | ||
if (token.action === "exists") | ||
if (token.action === "exists") { | ||
return "[" + escapeName(token.name) + "]"; | ||
} | ||
if (token.name === "id" && | ||
token.action === "equals" && | ||
!token.ignoreCase) | ||
!token.ignoreCase) { | ||
return "#" + escapeName(token.value); | ||
} | ||
if (token.name === "class" && | ||
token.action === "element" && | ||
!token.ignoreCase) | ||
!token.ignoreCase) { | ||
return "." + escapeName(token.value); | ||
return ("[" + | ||
escapeName(token.name) + | ||
actionTypes[token.action] + | ||
"='" + | ||
escapeName(token.value) + | ||
"'" + | ||
(token.ignoreCase ? "i" : "") + | ||
"]"); | ||
} | ||
var atributeName = escapeName(token.name); | ||
var action = actionTypes[token.action]; | ||
var value = escapeName(token.value); | ||
var ignoreCase = token.ignoreCase ? "i" : ""; | ||
return "[" + atributeName + action + "='" + value + "'" + ignoreCase + "]"; | ||
} | ||
@@ -55,0 +55,0 @@ if (token.type === "pseudo") { |
@@ -5,3 +5,3 @@ { | ||
"description": "a CSS selector parser", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"repository": { | ||
@@ -16,6 +16,6 @@ "url": "https://github.com/fb55/css-what" | ||
"scripts": { | ||
"test": "npm run ts-test && npm run eslint && npm run format -- --check", | ||
"ts-test": "ts-node tests/test.ts", | ||
"eslint": "eslint '**/*.ts'", | ||
"format": "prettier --write **/*.{ts,json,md}", | ||
"test": "jest --coverage -u && npm run lint", | ||
"coverage": "cat coverage/lcov.info | coveralls", | ||
"lint": "eslint --ext=js,ts src", | ||
"format": "prettier --write '**/*.{ts,md,json}'", | ||
"build": "tsc", | ||
@@ -26,9 +26,12 @@ "prepare": "npm run build" | ||
"devDependencies": { | ||
"@types/jest": "^24.0.16", | ||
"@types/node": "^12.6.2", | ||
"@typescript-eslint/eslint-plugin": "^1.12.0", | ||
"@typescript-eslint/parser": "^1.12.0", | ||
"coveralls": "^3.0.5", | ||
"eslint": "^6.0.1", | ||
"eslint-config-prettier": "^6.0.0", | ||
"jest": "^24.8.0", | ||
"prettier": "^1.18.2", | ||
"ts-node": "^8.3.0", | ||
"ts-jest": "^24.0.2", | ||
"typescript": "^3.5.3" | ||
@@ -41,2 +44,6 @@ }, | ||
"license": "BSD-2-Clause", | ||
"jest": { | ||
"preset": "ts-jest", | ||
"testEnvironment": "node" | ||
}, | ||
"prettier": { | ||
@@ -43,0 +50,0 @@ "tabWidth": 4 |
@@ -61,4 +61,2 @@ # css-what [![Build Status](https://secure.travis-ci.org/fb55/css-what.svg?branch=master)](http://travis-ci.org/fb55/css-what) | ||
[Get supported css-what with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-css-what?utm_source=npm-css-what&utm_medium=referral&utm_campaign=readme) | ||
## Security contact information | ||
@@ -68,1 +66,7 @@ | ||
Tidelift will coordinate the fix and disclosure. | ||
## `css-what` for enterprise | ||
Available as part of the Tidelift Subscription | ||
The maintainers of `css-what` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-css-what?utm_source=npm-css-what&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) |
21453
71
11