Socket
Socket
Sign inDemoInstall

html-parse-stringify2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-parse-stringify2 - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

14

lib/parse.js

@@ -39,7 +39,5 @@ /*jshint -W030 */

}
// check if this is a comment tag. if so, just return.
if (tag.indexOf('<!--') === 0) {
return;
}
var isOpen = tag.charAt(1) !== '/';
var isComment = tag.indexOf('<!--') === 0;
var start = index + tag.length;

@@ -49,3 +47,3 @@ var nextChar = html.charAt(start);

if (isOpen) {
if (isOpen && !isComment) {
level++;

@@ -79,4 +77,6 @@

if (!isOpen || current.voidElement) {
level--;
if (isComment || !isOpen || current.voidElement) {
if (!isComment) {
level--;
}
if (!inComponent && nextChar !== '<' && nextChar) {

@@ -83,0 +83,0 @@ // trailing text node

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

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

@@ -388,3 +388,3 @@ /* global console */

html = '<div>Hi <!-- I\'m a nested comment! with a <span></span> --></div><span><!--test--></span>';
html = '<div>Hi <!-- I\'m a nested comment! with a <span></span> -->there<strong>!</strong></div><span><!--test--></span>';
parsed = HTML.parse(html);

@@ -397,3 +397,11 @@ t.deepEqual(parsed, [{

children: [
{ type: 'text', content: 'Hi '}
{ type: 'text', content: 'Hi '},
{ type: 'text', content: 'there'},
{
type: 'tag',
name: 'strong',
attrs: {},
voidElement: false,
children: [{ type: 'text', content: '!'}]
}
]

@@ -400,0 +408,0 @@ },{

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