From 3a52ee97463d8ab1f35ef7c0f08d3696bc38e5c4 Mon Sep 17 00:00:00 2001 From: Adam Skoufis Date: Tue, 19 Sep 2023 14:07:41 +1000 Subject: [PATCH 1/5] fix: Fixed typo in JSDoc for HTMLElement `structure` method --- src/nodes/html.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nodes/html.ts b/src/nodes/html.ts index c8eebe8..c6d222a 100644 --- a/src/nodes/html.ts +++ b/src/nodes/html.ts @@ -407,7 +407,7 @@ export default class HTMLElement extends Node { } /** * Get DOM structure - * @return {string} strucutre + * @return {string} structure */ public get structure() { const res = [] as string[]; From 59e10a041cfa3b38ec04e942ae88a0b0448f037b Mon Sep 17 00:00:00 2001 From: milahu Date: Wed, 4 Oct 2023 18:17:21 +0200 Subject: [PATCH 2/5] restore the prepare script: npm run build --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2bc14ed..d05d50e 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "test:target": "mocha --recursive \"./test/tests\"", "test:ci": "cross-env TEST_TARGET=dist yarn run test:target", "posttest": "yarn run benchmark", - "prepare": "cd test && yarn install", + "prepare": "npm run build", "release": "standard-version && git push --follow-tags origin main" }, "keywords": [ From cd3fcd7ba3081c7b546351a282de04596fab502c Mon Sep 17 00:00:00 2001 From: milahu Date: Wed, 4 Oct 2023 18:28:58 +0200 Subject: [PATCH 3/5] fix the test:ci script: install packages in test/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d05d50e..44b6446 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "reset": "yarn run clean:global && yarn install && yarn build", "--------------- ": "", "test:target": "mocha --recursive \"./test/tests\"", - "test:ci": "cross-env TEST_TARGET=dist yarn run test:target", + "test:ci": "cd test && yarn install && cd .. && cross-env TEST_TARGET=dist yarn run test:target", "posttest": "yarn run benchmark", "prepare": "npm run build", "release": "standard-version && git push --follow-tags origin main" From 8e4e9e0a13796ed9a39ebb930b0ee5e55b578b82 Mon Sep 17 00:00:00 2001 From: julien Date: Sat, 7 Oct 2023 22:55:01 +0200 Subject: [PATCH 4/5] fix: #254 The abbr tag was interpreted like the br one for innerText. --- src/nodes/html.ts | 2 +- test/tests/issues/254.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/tests/issues/254.js diff --git a/src/nodes/html.ts b/src/nodes/html.ts index c6d222a..a9b6b2e 100644 --- a/src/nodes/html.ts +++ b/src/nodes/html.ts @@ -249,7 +249,7 @@ export default class HTMLElement extends Node { */ public get rawText() { // https://github.com/taoqf/node-html-parser/issues/249 - if (/br/i.test(this.rawTagName)) { + if (/^br$/i.test(this.rawTagName)) { return '\n'; } return this.childNodes.reduce((pre, cur) => { diff --git a/test/tests/issues/254.js b/test/tests/issues/254.js new file mode 100644 index 0000000..de0226b --- /dev/null +++ b/test/tests/issues/254.js @@ -0,0 +1,10 @@ +const { parse } = require('@test/test-target'); + +describe('issue 254', function () { + it('abbr in innertext should not turn into \\n', function () { + const html = `
Hello World
`; + const root = parse(html); + const div = root.querySelector('div'); + div.innerText.should.eql(`Hello World`); + }); +}); From 7fa50027430a539d197b448aaddfd7f29f6573d5 Mon Sep 17 00:00:00 2001 From: taoqf Date: Wed, 25 Oct 2023 14:22:27 +0800 Subject: [PATCH 5/5] chore(release): 6.1.11 --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c64250b..ee38516 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [6.1.11](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.10...v6.1.11) (2023-10-25) + + +### Bug Fixes + +* [#254](https://github.com/taoqf/node-fast-html-parser/issues/254) ([8e4e9e0](https://github.com/taoqf/node-fast-html-parser/commit/8e4e9e0a13796ed9a39ebb930b0ee5e55b578b82)) +* Fixed typo in JSDoc for HTMLElement `structure` method ([3a52ee9](https://github.com/taoqf/node-fast-html-parser/commit/3a52ee97463d8ab1f35ef7c0f08d3696bc38e5c4)) + ### [6.1.10](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.9...v6.1.10) (2023-09-15) diff --git a/package.json b/package.json index 44b6446..36c3ea9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-html-parser", - "version": "6.1.10", + "version": "6.1.11", "description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.", "main": "dist/index.js", "types": "dist/index.d.ts",