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

postcss-pseudo-class-any-link

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-pseudo-class-any-link - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

5

CHANGELOG.md
# Changes to :any-link
### 3.0.1 (December 8, 2016)
- Updated: Use destructing assignment on plugin options
- Updated: Use template literals
### 3.0.0 (December 5, 2016)

@@ -4,0 +9,0 @@

81

index.js

@@ -8,5 +8,5 @@ // tooling

prefix = ''
}) => {
} = {}) => {
// dashed prefix
const dashedPrefix = prefix ? '-' + prefix + '-' : '';
const dashedPrefix = prefix ? `-${ prefix }-` : '';

@@ -16,7 +16,7 @@ // any-link value

// selector pattern
// selector matcher
const selectorMatch = new RegExp(`${ dashedPrefix }any-link`);
return (css) => {
// for each rule
// walk each matching rule
css.walkRules(selectorMatch, (rule) => {

@@ -26,46 +26,51 @@ const rawSelector = rule.raws.selector && rule.raws.selector.raw || rule.selector;

// workaround for https://github.com/postcss/postcss-selector-parser/issues/28#issuecomment-171910556
if (rawSelector[rawSelector.length - 1] === ':') {
return;
}
if (rawSelector[rawSelector.length - 1] !== ':') {
// update the selector
rule.selector = parser((selectors) => {
// cache variables
let node;
let nodeIndex;
let selector;
let selectorLink;
let selectorVisited;
// update the selector
rule.selector = parser((selectors) => {
// cache variables
let node;
let nodeIndex;
let selector;
let selectorLink;
let selectorVisited;
// cache the selector index
let selectorIndex = -1;
// cache the selector index
let selectorIndex = -1;
// for each selector
while (selector = selectors.nodes[++selectorIndex]) {
// reset the node index
nodeIndex = -1;
// for each selector
while (selector = selectors.nodes[++selectorIndex]) {
// reset the node index
nodeIndex = -1;
// for each node
while (node = selector.nodes[++nodeIndex]) {
// if the node value matches the any-link value
if (node.value === anyLinkValue) {
// clone the selector
selectorLink = selector.clone();
selectorVisited = selector.clone();
// for each node
while (node = selector.nodes[++nodeIndex]) {
// if the node value matches the any-link value
if (node.value === anyLinkValue) {
// clone the selector
selectorLink = selector.clone();
selectorVisited = selector.clone();
// update the matching clone values
selectorLink.nodes[nodeIndex].value = ':link';
selectorVisited.nodes[nodeIndex].value = ':visited';
// update the matching clone values
selectorLink.nodes[nodeIndex].value = ':link';
selectorVisited.nodes[nodeIndex].value = ':visited';
// replace the selector with the clones and roll back the selector index
selectors.nodes.splice(selectorIndex--, 1, selectorLink, selectorVisited);
// replace the selector with the clones and roll back the selector index
selectors.nodes.splice(selectorIndex--, 1, selectorLink, selectorVisited);
// stop updating the selector
break;
// stop updating the selector
break;
}
}
}
}
}).process(rawSelector).result;
}).process(rawSelector).result;
}
});
};
});
// override plugin#process
module.exports.process = function (cssString, pluginOptions, processOptions) {
return postcss([
1 in arguments ? module.exports(pluginOptions) : module.exports()
]).process(cssString, processOptions);
};
{
"name": "postcss-pseudo-class-any-link",
"version": "3.0.0",
"version": "3.0.1",
"description": "Use the proposed :any-link pseudo-class in CSS",

@@ -30,7 +30,7 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>",

"echint-config-dev": "1.0.0",
"eslint": "^3.11.1",
"eslint": "^3.12.1",
"eslint-config-dev": "1.0.0",
"jscs": "^3.0.7",
"jscs-config-dev": "1.0.1",
"postcss-tape": "1.0.1"
"postcss-tape": "1.3.0"
},

@@ -37,0 +37,0 @@ "echint": {

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