Socket
Socket
Sign inDemoInstall

parse5

Package Overview
Dependencies
0
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.1 to 1.4.2

lib/common/doctype.js

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## 1.4.2
* Fix: htmlparser2 tree adapter `DocumentType.data` property rendering (GH [#45](https://github.com/inikulin/parse5/issues/45)).
## 1.4.1

@@ -2,0 +5,0 @@ * Fix: Location info handling for the implicitly generated `<html>` and `<body>` elements (GH [#44](https://github.com/inikulin/parse5/issues/44)).

19

lib/serialization/serializer.js
'use strict';
var DefaultTreeAdapter = require('../tree_adapters/default'),
Doctype = require('../common/doctype'),
Utils = require('../common/utils'),

@@ -43,7 +44,3 @@ HTML = require('../common/html');

//Enquote doctype ID
function enquoteDoctypeId(id) {
var quote = id.indexOf('"') !== -1 ? '\'' : '"';
return quote + id + quote;
}

@@ -182,15 +179,3 @@

this.html += '<!DOCTYPE ' + name;
if (publicId !== null)
this.html += ' PUBLIC ' + enquoteDoctypeId(publicId);
else if (systemId !== null)
this.html += ' SYSTEM';
if (systemId !== null)
this.html += ' ' + enquoteDoctypeId(systemId);
this.html += '>';
this.html += '<' + Doctype.serializeContent(name, publicId, systemId) + '>';
};

@@ -45,3 +45,3 @@ 'use strict';

tokenizer._emitCurrentToken = function () {
//NOTE: if we have pending character tokenmake it's end location equal to the
//NOTE: if we have pending character token make it's end location equal to the
//current token's start location.

@@ -59,5 +59,5 @@ if (this.currentCharacterToken)

if (this.currentCharacterToken && this.currentCharacterToken.location.end === -1) {
//NOTE: we don't need to increment preprocessor position here, since character token
//emission here is always forced by the start of the next token character token.
//So, we already have advanced position here.
//NOTE: we don't need to increment preprocessor position, since character token
//emission is always forced by the start of the next character token here.
//So, we already have advanced position.
this.currentCharacterToken.location.end = this.preprocessor.pos;

@@ -64,0 +64,0 @@ }

'use strict';
var Doctype = require('../common/doctype');
//Conversion tables for DOM Level1 structure emulation

@@ -122,15 +124,5 @@ var nodeTypes = {

exports.setDocumentType = function (document, name, publicId, systemId) {
var data = '!DOCTYPE';
var data = Doctype.serializeContent(name, publicId, systemId),
doctypeNode = null;
if (name)
data += ' ' + name;
if (publicId)
data += ' PUBLIC "' + publicId + '"';
if (systemId)
data += ' "' + systemId + '"';
var doctypeNode = null;
for (var i = 0; i < document.children.length; i++) {

@@ -137,0 +129,0 @@ if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') {

{
"name": "parse5",
"description": "WHATWG HTML5 specification-compliant, fast and ready for production HTML parsing/serialization toolset for Node.",
"version": "1.4.1",
"description": "WHATWG HTML5 specification-compliant, fast and ready for production HTML parsing/serialization toolset for Node and io.js.",
"version": "1.4.2",
"author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)",

@@ -6,0 +6,0 @@ "contributors": [

@@ -6,6 +6,7 @@ <p align="center">

[![Build Status](https://api.travis-ci.org/inikulin/parse5.svg)](https://travis-ci.org/inikulin/parse5)
[![npm](https://img.shields.io/npm/v/parse5.svg)](https://www.npmjs.com/package/parse5)
*WHATWG HTML5 specification-compliant, fast and ready for production HTML parsing/serialization toolset for Node.*
*WHATWG HTML5 specification-compliant, fast and ready for production HTML parsing/serialization toolset for Node and io.js.*
To build [TestCafé](http://testcafe.devexpress.com/) we needed fast and ready for production HTML parser, which will parse HTML as a modern browser's parser.
I needed fast and ready for production HTML parser, which will parse HTML as a modern browser's parser.
Existing solutions were either too slow or their output was too inaccurate. So, this is how parse5 was born.

@@ -12,0 +13,0 @@

Sorry, the diff of this file is too big to display

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