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

simple-html-tokenizer

Package Overview
Dependencies
Maintainers
6
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-html-tokenizer - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

.nyc_output/67bda95bcfd5998b68db1a665a02ac53.json

17

dist/es6/index.js

@@ -347,2 +347,3 @@ /**

else if (char === '/') {
this.delegate.finishAttributeValue();
this.consume();

@@ -499,2 +500,3 @@ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);

this.tokenizer = new EventedTokenizer(this, entityParser);
this._currentAttribute = undefined;
}

@@ -541,11 +543,4 @@ Tokenizer.prototype.tokenize = function (input) {

Tokenizer.prototype.currentAttribute = function () {
var attributes = this.current("StartTag" /* StartTag */).attributes;
if (attributes.length === 0) {
throw new Error('expected to have an attribute started');
}
return attributes[attributes.length - 1];
return this._currentAttribute;
};
Tokenizer.prototype.pushAttribute = function (attribute) {
this.current("StartTag" /* StartTag */).attributes.push(attribute);
};
Tokenizer.prototype.addLocInfo = function () {

@@ -621,3 +616,3 @@ if (this.options.loc) {

Tokenizer.prototype.beginAttribute = function () {
this.pushAttribute(['', '', false]);
this._currentAttribute = ['', '', false];
};

@@ -633,3 +628,5 @@ Tokenizer.prototype.appendToAttributeName = function (char) {

};
Tokenizer.prototype.finishAttributeValue = function () { };
Tokenizer.prototype.finishAttributeValue = function () {
this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute);
};
Tokenizer.prototype.reportSyntaxError = function (message) {

@@ -636,0 +633,0 @@ this.current().syntaxError = message;

@@ -353,2 +353,3 @@ (function (global, factory) {

else if (char === '/') {
this.delegate.finishAttributeValue();
this.consume();

@@ -505,2 +506,3 @@ this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);

this.tokenizer = new EventedTokenizer(this, entityParser);
this._currentAttribute = undefined;
}

@@ -547,11 +549,4 @@ Tokenizer.prototype.tokenize = function (input) {

Tokenizer.prototype.currentAttribute = function () {
var attributes = this.current("StartTag" /* StartTag */).attributes;
if (attributes.length === 0) {
throw new Error('expected to have an attribute started');
}
return attributes[attributes.length - 1];
return this._currentAttribute;
};
Tokenizer.prototype.pushAttribute = function (attribute) {
this.current("StartTag" /* StartTag */).attributes.push(attribute);
};
Tokenizer.prototype.addLocInfo = function () {

@@ -627,3 +622,3 @@ if (this.options.loc) {

Tokenizer.prototype.beginAttribute = function () {
this.pushAttribute(['', '', false]);
this._currentAttribute = ['', '', false];
};

@@ -639,3 +634,5 @@ Tokenizer.prototype.appendToAttributeName = function (char) {

};
Tokenizer.prototype.finishAttributeValue = function () { };
Tokenizer.prototype.finishAttributeValue = function () {
this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute);
};
Tokenizer.prototype.reportSyntaxError = function (message) {

@@ -642,0 +639,0 @@ this.current().syntaxError = message;

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

import { Attribute, EntityParser, Token, TokenizerDelegate, TokenMap, TokenType, TokenizerOptions } from './types';
import { EntityParser, Token, TokenizerDelegate, TokenMap, TokenType, TokenizerOptions } from './types';
export default class Tokenizer implements TokenizerDelegate {

@@ -9,2 +9,3 @@ private options;

private tokens;
private _currentAttribute?;
constructor(entityParser: EntityParser, options?: TokenizerOptions);

@@ -19,4 +20,3 @@ tokenize(input: string): Token[];

push(token: Token): void;
currentAttribute(): [string, string, boolean];
pushAttribute(attribute: Attribute): void;
currentAttribute(): [string, string, boolean] | undefined;
addLocInfo(): void;

@@ -23,0 +23,0 @@ beginData(): void;

{
"name": "simple-html-tokenizer",
"version": "0.5.4",
"version": "0.5.5",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Simple HTML Tokenizer is a lightweight JavaScript library that can be used to tokenize the kind of HTML normally found in templates.",

@@ -404,2 +404,3 @@ import { preprocessInput, isAlpha, isSpace } from './utils';

} else if (char === '/') {
this.delegate.finishAttributeValue();
this.consume();

@@ -406,0 +407,0 @@ this.transitionTo(TokenizerState.selfClosingStartTag);

@@ -18,2 +18,3 @@ import EventedTokenizer from './evented-tokenizer';

private tokens: Token[] = [];
private _currentAttribute?: Attribute;

@@ -25,2 +26,3 @@ constructor(

this.tokenizer = new EventedTokenizer(this, entityParser);
this._currentAttribute = undefined;
}

@@ -80,13 +82,5 @@

currentAttribute() {
let { attributes } = this.current(TokenType.StartTag);
if (attributes.length === 0) {
throw new Error('expected to have an attribute started');
}
return attributes[attributes.length - 1];
return this._currentAttribute;
}
pushAttribute(attribute: Attribute) {
this.current(TokenType.StartTag).attributes.push(attribute);
}
addLocInfo() {

@@ -179,18 +173,20 @@ if (this.options.loc) {

beginAttribute() {
this.pushAttribute(['', '', false]);
this._currentAttribute = ['', '', false];
}
appendToAttributeName(char: string) {
this.currentAttribute()[0] += char;
this.currentAttribute()![0] += char;
}
beginAttributeValue(isQuoted: boolean) {
this.currentAttribute()[2] = isQuoted;
this.currentAttribute()![2] = isQuoted;
}
appendToAttributeValue(char: string) {
this.currentAttribute()[1] += char;
this.currentAttribute()![1] += char;
}
finishAttributeValue() {}
finishAttributeValue() {
this.current(TokenType.StartTag).attributes.push(this._currentAttribute!);
}

@@ -197,0 +193,0 @@ reportSyntaxError(message: string) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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