parse5 7.1.0 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,6 +39,9 @@ const TABLE_CONTEXT = [$.TABLE, $.TEMPLATE, $.HTML];
39
39
  const TABLE_CELLS = [$.TD, $.TH];
40
40
  //Stack of open elements
41
41
  export class OpenElementStack {
42
+ get currentTmplContentOrNode() {
43
+ return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
44
+ }
42
45
  constructor(document, treeAdapter, handler) {
43
46
  this.treeAdapter = treeAdapter;
44
47
  this.handler = handler;
@@ -49,9 +52,6 @@ export class OpenElementStack {
49
52
  this.currentTagId = $.UNKNOWN;
50
53
  this.current = document;
51
54
  }
52
- get currentTmplContentOrNode() {
53
- return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
54
- }
55
55
  //Index of element
56
56
  _indexOf(element) {
57
57
  return this.items.lastIndexOf(element, this.stackTop);
@@ -2235,7 +2235,7 @@ export class Tokenizer {
2235
2235
  this._emitEOFToken();
2236
2236
  break;
2237
2237
  }
2238
- default:
2238
+ default: {
2239
2239
  if (this._consumeSequenceIfMatch($$.PUBLIC, false)) {
2240
2240
  this.state = State.AFTER_DOCTYPE_PUBLIC_KEYWORD;
2241
2241
  }
@@ -2250,6 +2250,7 @@ export class Tokenizer {
2250
2250
  this.state = State.BOGUS_DOCTYPE;
2251
2251
  this._stateBogusDoctype(cp);
2252
2252
  }
2253
+ }
2253
2254
  }
2254
2255
  }
2255
2256
  // After DOCTYPE public keyword state
@@ -124,7 +124,8 @@ export class Preprocessor {
124
124
  this.endOfChunkHit = !this.lastChunkWritten;
125
125
  return $.EOF;
126
126
  }
127
- return this.html.charCodeAt(pos);
127
+ const code = this.html.charCodeAt(pos);
128
+ return code === $.CARRIAGE_RETURN ? $.LINE_FEED : code;
128
129
  }
129
130
  advance() {
130
131
  this.pos++;
@@ -77,9 +77,9 @@ export interface DocumentType {
77
77
  /** Comment source code location info. Available if location info is enabled. */
78
78
  sourceCodeLocation?: Location | null;
79
79
  }
80
- export declare type ParentNode = Document | DocumentFragment | Element | Template;
81
- export declare type ChildNode = Element | Template | CommentNode | TextNode | DocumentType;
82
- export declare type Node = ParentNode | ChildNode;
83
- export declare type DefaultTreeAdapterMap = TreeAdapterTypeMap<Node, ParentNode, ChildNode, Document, DocumentFragment, Element, CommentNode, TextNode, Template, DocumentType>;
80
+ export type ParentNode = Document | DocumentFragment | Element | Template;
81
+ export type ChildNode = Element | Template | CommentNode | TextNode | DocumentType;
82
+ export type Node = ParentNode | ChildNode;
83
+ export type DefaultTreeAdapterMap = TreeAdapterTypeMap<Node, ParentNode, ChildNode, Document, DocumentFragment, Element, CommentNode, TextNode, Template, DocumentType>;
84
84
  export declare const defaultTreeAdapter: TreeAdapter<DefaultTreeAdapterMap>;
85
85
  //# sourceMappingURL=default.d.ts.map
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "parse5",
3
3
  "type": "module",
4
4
  "description": "HTML parser and serializer.",
5
- "version": "7.1.0",
5
+ "version": "7.1.2",
6
6
  "author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)",
7
7
  "contributors": "https://github.com/inikulin/parse5/graphs/contributors",
8
8
  "homepage": "https://github.com/inikulin/parse5",
@@ -43,6 +43,7 @@
43
43
  "url": "git://github.com/inikulin/parse5.git"
44
44
  },
45
45
  "files": [
46
+ "dist/cjs/package.json",
46
47
  "dist/**/*.js",
47
48
  "dist/**/*.d.ts"
48
49
  ]