Socket
Socket
Sign inDemoInstall

html-parse-stringify2

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

18

lib/parse-tag.js

@@ -1,2 +0,2 @@

var attrRE = /([\w-]+)|(['"])([.\s\S]*?)\2/g;
var attrRE = /([\w-]+)|=|(['"])([.\s\S]*?)\2/g;
var voidElements = require('void-elements');

@@ -7,2 +7,3 @@

var key;
var expectingValueAfterEquals = true;
var res = {

@@ -17,4 +18,13 @@ type: 'tag',

tag.replace(attrRE, function (match) {
if (i % 2) {
key = match;
if (match === '=') {
expectingValueAfterEquals = true;
i++;
return;
}
if (!expectingValueAfterEquals) {
if (key) {
res.attrs[key] = key; // boolean attribute
}
key=match;
} else {

@@ -28,5 +38,7 @@ if (i === 0) {

res.attrs[key] = match.replace(/^['"]|['"]$/g, '');
key=undefined;
}
}
i++;
expectingValueAfterEquals = false;
});

@@ -33,0 +45,0 @@

2

package.json
{
"name": "html-parse-stringify2",
"description": "Parses well-formed HTML (meaning all tags closed) into an AST and back. quickly.",
"version": "2.0.0",
"version": "2.0.1",
"author": "Ray Di Ciaccio <ray.diciaccio@gmail.com>",

@@ -6,0 +6,0 @@ "bugs": {

@@ -69,3 +69,3 @@ var test = require('tape');

});
tag = '<textarea placeholder=\'Hey Usher, \n\nAre these modals for real?!\' class=\'placeholder-value\'>';

@@ -84,3 +84,17 @@

tag = '<input checked name="sad" type="checkbox">';
t.deepEqual(parseTag(tag), {
type: 'tag',
attrs: {
type: 'checkbox',
checked: 'checked',
name: 'sad'
},
name: 'input',
voidElement: true,
children: []
});
t.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc