Socket
Socket
Sign inDemoInstall

html-parser

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-parser - npm Package Compare versions

Comparing version 0.6.5 to 0.6.6

.travis.yml

12

package.json
{
"name": "html-parser",
"version": "0.6.5",
"version": "0.6.6",
"description": "HTML/XML parser with less explosions",

@@ -12,2 +12,6 @@ "keywords": [ "html", "xml", "parser", "explosion" ],

"contributors": [
{ "name": "jdponomarev" }
],
"main": "./src/parser.js",

@@ -23,9 +27,9 @@ "directories": {

"devDependencies": {
"mocha": ">= 1.1.0",
"should": ">= 0.6.3"
"mocha": "1.8.1",
"should": "1.2.1"
},
"scripts": {
"test": "./test.sh"
"test": "node_modules/.bin/mocha -R spec ./tests"
}
}
# html-parser
[![Build Status](https://travis-ci.org/tmont/html-parser.png)](https://travis-ci.org/tmont/html-parser)
Now with less explosions!

@@ -20,3 +22,3 @@

var html = '<!doctype html><html><body onload="alert(\'hello\');">Yo<br />dawg</body></html>';
var html = '<!doctype html><html><body onload="alert(\'hello\');">Hello<br />world</body></html>';
htmlParser.parse(html, {

@@ -29,3 +31,4 @@ openElement: function(name) { console.log('open: %s', name); },

attribute: function(name, value) { console.log('attribute: %s=%s', name, value); },
docType: function(value) { console.log('doctype: %s', value); }
docType: function(value) { console.log('doctype: %s', value); },
text: function(value) { console.log('text: %s', value); }
});

@@ -40,4 +43,6 @@

close token: >
text: Hello
open: br
close token: />
text: world
close: body

@@ -44,0 +49,0 @@ close: html

@@ -382,3 +382,3 @@ var parseContext = require('./context');

name = name.toLowerCase();
if (toRemove.attributes(name)) {
if (toRemove.attributes(name, value)) {
return;

@@ -425,2 +425,2 @@ }

return sanitized;
};
};

@@ -159,2 +159,12 @@ var should = require('should');

});
it('should sanitize based on attribute value', function() {
var html = '<foo id="abc"></foo><foo id="def"></foo>';
var sanitized = helpers.parser.sanitize(html, {
attributes: function(name, value) {
return value === 'abc';
}
});
sanitized.should.equal('<foo></foo><foo id="def"></foo>');
});
});
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