simple-html-tokenizer
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -150,4 +150,9 @@ (function (global, factory) { | ||
markTagStart: function() { | ||
// these properties to be removed in next major bump | ||
this.tagLine = this.line; | ||
this.tagColumn = this.column; | ||
if (this.delegate.tagOpen) { | ||
this.delegate.tagOpen(); | ||
} | ||
}, | ||
@@ -287,9 +292,12 @@ | ||
beforeAttributeName: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.consume(); | ||
return; | ||
} else if (char === "/") { | ||
this.state = 'selfClosingStartTag'; | ||
this.consume(); | ||
} else if (char === ">") { | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
@@ -300,2 +308,3 @@ this.state = 'beforeData'; | ||
this.delegate.beginAttribute(); | ||
this.consume(); | ||
this.delegate.appendToAttributeName(char); | ||
@@ -306,18 +315,23 @@ } | ||
attributeName: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.state = 'afterAttributeName'; | ||
this.consume(); | ||
} else if (char === "/") { | ||
this.delegate.beginAttributeValue(false); | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.state = 'selfClosingStartTag'; | ||
} else if (char === "=") { | ||
this.state = 'beforeAttributeValue'; | ||
this.consume(); | ||
} else if (char === ">") { | ||
this.delegate.beginAttributeValue(false); | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
this.state = 'beforeData'; | ||
} else { | ||
this.consume(); | ||
this.delegate.appendToAttributeName(char); | ||
@@ -328,5 +342,6 @@ } | ||
afterAttributeName: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.consume(); | ||
return; | ||
@@ -336,4 +351,6 @@ } else if (char === "/") { | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.state = 'selfClosingStartTag'; | ||
} else if (char === "=") { | ||
this.consume(); | ||
this.state = 'beforeAttributeValue'; | ||
@@ -343,2 +360,3 @@ } else if (char === ">") { | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
@@ -349,2 +367,3 @@ this.state = 'beforeData'; | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.state = 'attributeName'; | ||
@@ -357,14 +376,18 @@ this.delegate.beginAttribute(); | ||
beforeAttributeValue: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.consume(); | ||
} else if (char === '"') { | ||
this.state = 'attributeValueDoubleQuoted'; | ||
this.delegate.beginAttributeValue(true); | ||
this.consume(); | ||
} else if (char === "'") { | ||
this.state = 'attributeValueSingleQuoted'; | ||
this.delegate.beginAttributeValue(true); | ||
this.consume(); | ||
} else if (char === ">") { | ||
this.delegate.beginAttributeValue(false); | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
@@ -375,2 +398,3 @@ this.state = 'beforeData'; | ||
this.delegate.beginAttributeValue(false); | ||
this.consume(); | ||
this.delegate.appendToAttributeValue(char); | ||
@@ -377,0 +401,0 @@ } |
@@ -100,4 +100,9 @@ import { preprocessInput, isAlpha, isSpace } from './utils'; | ||
markTagStart: function() { | ||
// these properties to be removed in next major bump | ||
this.tagLine = this.line; | ||
this.tagColumn = this.column; | ||
if (this.delegate.tagOpen) { | ||
this.delegate.tagOpen(); | ||
} | ||
}, | ||
@@ -237,9 +242,12 @@ | ||
beforeAttributeName: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.consume(); | ||
return; | ||
} else if (char === "/") { | ||
this.state = 'selfClosingStartTag'; | ||
this.consume(); | ||
} else if (char === ">") { | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
@@ -250,2 +258,3 @@ this.state = 'beforeData'; | ||
this.delegate.beginAttribute(); | ||
this.consume(); | ||
this.delegate.appendToAttributeName(char); | ||
@@ -256,18 +265,23 @@ } | ||
attributeName: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.state = 'afterAttributeName'; | ||
this.consume(); | ||
} else if (char === "/") { | ||
this.delegate.beginAttributeValue(false); | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.state = 'selfClosingStartTag'; | ||
} else if (char === "=") { | ||
this.state = 'beforeAttributeValue'; | ||
this.consume(); | ||
} else if (char === ">") { | ||
this.delegate.beginAttributeValue(false); | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
this.state = 'beforeData'; | ||
} else { | ||
this.consume(); | ||
this.delegate.appendToAttributeName(char); | ||
@@ -278,5 +292,6 @@ } | ||
afterAttributeName: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.consume(); | ||
return; | ||
@@ -286,4 +301,6 @@ } else if (char === "/") { | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.state = 'selfClosingStartTag'; | ||
} else if (char === "=") { | ||
this.consume(); | ||
this.state = 'beforeAttributeValue'; | ||
@@ -293,2 +310,3 @@ } else if (char === ">") { | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
@@ -299,2 +317,3 @@ this.state = 'beforeData'; | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.state = 'attributeName'; | ||
@@ -307,14 +326,18 @@ this.delegate.beginAttribute(); | ||
beforeAttributeValue: function() { | ||
var char = this.consume(); | ||
var char = this.peek(); | ||
if (isSpace(char)) { | ||
this.consume(); | ||
} else if (char === '"') { | ||
this.state = 'attributeValueDoubleQuoted'; | ||
this.delegate.beginAttributeValue(true); | ||
this.consume(); | ||
} else if (char === "'") { | ||
this.state = 'attributeValueSingleQuoted'; | ||
this.delegate.beginAttributeValue(true); | ||
this.consume(); | ||
} else if (char === ">") { | ||
this.delegate.beginAttributeValue(false); | ||
this.delegate.finishAttributeValue(); | ||
this.consume(); | ||
this.delegate.finishTag(); | ||
@@ -325,2 +348,3 @@ this.state = 'beforeData'; | ||
this.delegate.beginAttributeValue(false); | ||
this.consume(); | ||
this.delegate.appendToAttributeValue(char); | ||
@@ -327,0 +351,0 @@ } |
{ | ||
"name": "simple-html-tokenizer", | ||
"version": "0.2.4", | ||
"version": "0.2.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.", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
204500
1304
12