Comparing version 2.0.2 to 2.1.0
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -20,6 +20,6 @@ 'use strict'; | ||
* @typedef {Object} ElementLocationInfo | ||
* @extends LocationInfo | ||
* @extends StartTagLocationInfo | ||
* | ||
* @property {LocationInfo} startTag - Element's start tag {@link LocationInfo}. | ||
* @property {LocationInfo} endTag - Element's end tag {@link LocationInfo}. | ||
* @property {StartTagLocationInfo} startTag - Element's start tag location info. | ||
* @property {LocationInfo} endTag - Element's end tag location info. | ||
*/ | ||
@@ -33,2 +33,4 @@ if (!loc.startTag) { | ||
}; | ||
if (loc.attrs) | ||
loc.startTag.attrs = loc.attrs; | ||
} | ||
@@ -163,3 +165,3 @@ | ||
var tmplContent = this.treeAdapter.getChildNodes(this.openElements.current)[0]; | ||
var tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); | ||
@@ -166,0 +168,0 @@ tmplContent.__location = null; |
@@ -95,2 +95,28 @@ 'use strict'; | ||
tokenizer._createAttr = function (attrNameFirstCh) { | ||
tokenizerProto._createAttr.call(this, attrNameFirstCh); | ||
this.currentAttrLocation = { | ||
line: line, | ||
col: col, | ||
startOffset: this.preprocessor.pos, | ||
endOffset: -1 | ||
}; | ||
}; | ||
tokenizer._leaveAttrValue = function (toState) { | ||
tokenizerProto._leaveAttrValue.call(this, toState); | ||
this.currentAttrLocation.endOffset = this.preprocessor.pos; | ||
if (!this.currentToken.location.attrs) | ||
this.currentToken.location.attrs = {}; | ||
/** | ||
* @typedef {Object} StartTagLocationInfo | ||
* @extends LocationInfo | ||
* | ||
* @property {Dictionary<String, LocationInfo>} attrs - Start tag attributes' location info. | ||
*/ | ||
this.currentToken.location.attrs[this.currentAttr.name] = this.currentAttrLocation; | ||
}; | ||
//NOTE: patch token emission methods to determine end location | ||
@@ -97,0 +123,0 @@ tokenizer._emitCurrentToken = function () { |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -13,3 +13,4 @@ 'use strict'; | ||
* @property {Boolean} [locationInfo=false] - Enables source code location information for the tokens. | ||
* When enabled, each token event handler will receive {@link LocationInfo} object as its last argument. | ||
* When enabled, each token event handler will receive {@link LocationInfo} (or {@link StartTagLocationInfo}) | ||
* object as its last argument. | ||
*/ | ||
@@ -164,3 +165,3 @@ var DEFAULT_OPTIONS = { | ||
* @param {Boolean} selfClosing - Indicates if the tag is self-closing. | ||
* @param {LocationInfo} [location] - Start tag source code location info. | ||
* @param {StartTagLocationInfo} [location] - Start tag source code location info. | ||
* Available if location info is enabled in {@link SAXParserOptions}. | ||
@@ -167,0 +168,0 @@ */ |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -76,3 +76,3 @@ 'use strict'; | ||
* | ||
* @function createElement | ||
* @function createCommentNode | ||
* @memberof TreeAdapter | ||
@@ -140,3 +140,3 @@ * | ||
/** | ||
* Sets the <template> element content element. | ||
* Sets the `<template>` element content element. | ||
* | ||
@@ -146,3 +146,3 @@ * @function setTemplateContent | ||
* | ||
* @param {ASTNode<TemplateElement>} templateElement - <template> element. | ||
* @param {ASTNode<TemplateElement>} templateElement - `<template>` element. | ||
* @param {ASTNode<DocumentFragment>} contentTemplate - Content element. | ||
@@ -158,3 +158,3 @@ * | ||
/** | ||
* Returns the <template> element content element. | ||
* Returns the `<template>` element content element. | ||
* | ||
@@ -164,5 +164,5 @@ * @function getTemplateContent | ||
* | ||
* @param {ASTNode<DocumentFragment>} templateElement - <template> element. | ||
* @param {ASTNode<TemplateElement>} templateElement - `<template>` element. | ||
* @returns {Boolean} | ||
* @returns {ASTNode<DocumentFragment>} | ||
* | ||
@@ -233,3 +233,3 @@ * @see {@link https://github.com/inikulin/parse5/blob/tree-adapter-docs-rev/lib/tree_adapters/default.js#L166|default implementation.} | ||
* | ||
* @function setQuirksMode | ||
* @function isQuirksMode | ||
* @memberof TreeAdapter | ||
@@ -460,3 +460,3 @@ * | ||
* | ||
* @function getTextNodeContent | ||
* @function getCommentNodeContent | ||
* @memberof TreeAdapter | ||
@@ -463,0 +463,0 @@ * |
{ | ||
"name": "parse5", | ||
"description": "WHATWG HTML5 specification-compliant, fast and ready for production HTML parsing/serialization toolset for Node.js", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)", | ||
"contributors": [ | ||
"Alan Clarke (https://github.com/alanclarke)", | ||
"Evan You (http://evanyou.me)", | ||
"Saksham Aggarwal <s.agg2021@gmail.com>", | ||
@@ -44,3 +45,7 @@ "Sebastian Mayr <sebmaster16@gmail.com> (http://blog.smayr.name)", | ||
"sax", | ||
"simple api" | ||
"simple api", | ||
"parse", | ||
"tokenize", | ||
"serialize", | ||
"tokenizer" | ||
], | ||
@@ -47,0 +52,0 @@ "license": "MIT", |
@@ -31,3 +31,7 @@ <p align="center"> | ||
<p align="center"> | ||
<a href="http://astexplorer.net/#/1CHlCXc4n4">Online playground</a> | ||
</p> | ||
<p align="center"> | ||
<a href="https://github.com/inikulin/parse5/issues">Issue tracker</a> | ||
</p> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
7373
37
377700