Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@markuplint/selector

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/selector - npm Package Compare versions

Comparing version 4.0.0-dev.20 to 4.0.0-dev.23

52

lib/match-selector.js

@@ -189,38 +189,30 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

}
if (selector.attrName) {
const selectorAttrName = selector.attrName;
const matchedAttrNameList = [...el.attributes].map(attr => {
const attrName = attr.name;
const matchedAttrName = regexSelectorMatches(selectorAttrName, attrName, isPureHTMLElement(el));
const isPure = isPureHTMLElement(el);
if (selector.attrName || selector.attrValue) {
const matchedAttrList = [...el.attributes]
.map(attr => {
const matchedAttrName = regexSelectorMatches(selector.attrName, attr.name, isPure);
if (selector.attrName && !matchedAttrName) {
return null;
}
const matchedAttrValue = regexSelectorMatches(selector.attrValue, attr.value, isPure);
if (selector.attrValue && !matchedAttrValue) {
return null;
}
if (matchedAttrName) {
delete matchedAttrName.$0;
data = {
...data,
...matchedAttrName,
};
specifiedAttr.set(attrName, '');
}
return matchedAttrName;
});
if (!matchedAttrNameList.some(_ => !!_)) {
matched = false;
}
}
if (selector.attrValue) {
const selectorAttrValue = selector.attrValue;
const matchedAttrValueList = [...el.attributes].map(attr => {
const attrName = attr.name;
const attrValue = attr.value;
const matchedAttrValue = regexSelectorMatches(selectorAttrValue, attrValue, isPureHTMLElement(el));
if (matchedAttrValue) {
delete matchedAttrValue.$0;
data = {
...data,
...matchedAttrValue,
};
specifiedAttr.set(attrName, attrValue);
}
return matchedAttrValue;
});
if (!matchedAttrValueList.some(_ => !!_)) {
data = {
...data,
...matchedAttrName,
...matchedAttrValue,
};
specifiedAttr.set(attr.name, matchedAttrValue ? attr.value : '');
return matchedAttrValue ?? matchedAttrName ?? null;
})
.filter((a) => !!a);
if (matchedAttrList.length === 0) {
matched = false;

@@ -227,0 +219,0 @@ }

@@ -1,3 +0,3 @@

export declare function regexSelectorMatches(reg: string, raw: string, ignoreCase: boolean): {
export declare function regexSelectorMatches(reg: string | undefined, raw: string, ignoreCase: boolean): {
[x: string]: string;
} | null;
export function regexSelectorMatches(reg, raw, ignoreCase) {
if (!reg) {
return null;
}
const res = {};

@@ -3,0 +6,0 @@ const pattern = toRegexp(reg);

{
"name": "@markuplint/selector",
"version": "4.0.0-dev.20+6b35da16",
"version": "4.0.0-dev.23+d6f2aa9bc",
"description": "Extended W3C Selectors matcher",

@@ -28,13 +28,13 @@ "repository": "git@github.com:markuplint/markuplint.git",

"dependencies": {
"@markuplint/ml-spec": "4.0.0-dev.20+6b35da16",
"@markuplint/ml-spec": "4.0.0-dev.23+d6f2aa9bc",
"@types/debug": "^4.1.12",
"debug": "^4.3.4",
"postcss-selector-parser": "^6.0.13",
"type-fest": "^4.8.3"
"postcss-selector-parser": "^6.0.15",
"type-fest": "^4.9.0"
},
"devDependencies": {
"@types/jsdom": "21.1.6",
"jsdom": "23.0.1"
"jsdom": "24.0.0"
},
"gitHead": "6b35da161d94f784953d0adecc2d28502052d92a"
"gitHead": "d6f2aa9bc287768466f23b5340e4e0eecfa30d59"
}

Sorry, the diff of this file is not supported yet

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