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

checkcss

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checkcss - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

15

dist/CheckCSS.js

@@ -22,7 +22,7 @@ import { isCSSStyleRule, isElement, isGroupingRule, isLinkElement, parseSelectorForClassnames, } from './util.js';

#seenStylesheets = new WeakMap();
// Hook for filtering classnames in DOM. Thi is called whenever a new
// Hook for filtering classnames in DOM. This is called whenever a new
// classname is detected in the DOM. Callback should return true to indicate
// the class should be checked, false to ignore.
onClassnameDetected;
// Callback when undefined classname is detected (defaults to console.warn())
// Callback when undefined classname is detected (defaults to console.log())
onUndefinedClassname(classname) {

@@ -78,8 +78,6 @@ console.log(`%ccheckcss%c: No CSS rule for %c.${classname}%c, referenced by: %o`, 'color: darkorange', '', 'font-weight: bold', '', this.#documentElement.querySelectorAll(`.${CSS.escape(classname)}`));

}
if (!this.onUndefinedClassname)
return;
for (const [classname, status] of this.#classnames) {
if (status == ClassnameStatus.DETECTED) {
this.#classnames.set(classname, ClassnameStatus.EMITTED);
this.onUndefinedClassname(classname);
this.onUndefinedClassname?.(classname);
}

@@ -100,3 +98,8 @@ }

continue;
this.#classnames.set(n, ClassnameStatus.DETECTED);
if (this.onClassnameDetected?.(n, el) === false) {
this.#classnames.set(n, ClassnameStatus.IGNORED);
}
else {
this.#classnames.set(n, ClassnameStatus.DETECTED);
}
}

@@ -103,0 +106,0 @@ // Recurse into children(?)

2

dist/index.js

@@ -14,2 +14,3 @@ import { CheckCSS } from './CheckCSS.js';

export function ignoreCSS(re) {
warn('ignoreRE is deprecated and will be removed in the next major release. Use CheckCSS#onClassnameDetected instead');
ignoreRE = re;

@@ -21,2 +22,3 @@ }

checkcss = new CheckCSS(document);
// Legacy API support for ignoreRE.
checkcss.onClassnameDetected = (classname, el) => {

@@ -23,0 +25,0 @@ return ignoreRE?.test(classname) ?? true;

{
"name": "checkcss",
"version": "2.0.4",
"version": "2.0.5",
"type": "module",

@@ -5,0 +5,0 @@ "description": "Detect references to undefined CSS classes",

Sorry, the diff of this file is not supported yet

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