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

cssfilter

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssfilter - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

11

lib/parser.js

@@ -47,3 +47,12 @@ /**

var c = css[i];
if (c === '(') {
if (c === '/' && css[i + 1] === '*') {
// 备注开始
var j = css.indexOf('*/', i + 2);
// 如果没有正常的备注结束,则后面的部分全部跳过
if (j === -1) break;
// 直接将当前位置调到备注结尾,并且初始化状态
i = j + 1;
lastPos = i + 1;
isParenthesisOpen = false;
} else if (c === '(') {
isParenthesisOpen = true;

@@ -50,0 +59,0 @@ } else if (c === ')') {

2

package.json
{
"name": "cssfilter",
"version": "0.0.2",
"version": "0.0.3",
"description": "Sanitize untrusted CSS with a configuration specified by a Whitelist. 根据白名单过滤CSS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,3 +16,3 @@ # cssfilter

var cssfilter = require('cssfilter');
var css = cssfilter('position:fixed; width:100px; height:100px; background:#aaa;');
var css = cssfilter('position:fixed; /* this is comments */ width:100px; height:100px; background:#aaa;');
console.log(css);

@@ -19,0 +19,0 @@ // 输出:width:100px; height:100px; background:#aaa;

@@ -26,2 +26,12 @@ /**

it('stript comments', function () {
parseStyle('/*width: 100px;\nhe*/ight:200px; /**/ y:url(a/*b*/); /*font-size:400; */font:none;', function (sourcePosition, position, name, value, source) {
if (name === 'font') {
value.should.equal('none');
}
return name + ':' + value;
}).should.equal('ight:200px; font:none;');
});
it('ending without `;`', function () {

@@ -28,0 +38,0 @@ parseStyle('width: 100px;height:200px; font-size:400', function (sourcePosition, position, name, value, source) {

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