File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ export default class HTMLElement extends Node {
249
249
*/
250
250
public get rawText ( ) {
251
251
// https://github.com/taoqf/node-html-parser/issues/249
252
- if ( / b r / i. test ( this . rawTagName ) ) {
252
+ if ( / ^ b r $ / i. test ( this . rawTagName ) ) {
253
253
return '\n' ;
254
254
}
255
255
return this . childNodes . reduce ( ( pre , cur ) => {
Original file line number Diff line number Diff line change
1
+ const { parse } = require ( '@test/test-target' ) ;
2
+
3
+ describe ( 'issue 254' , function ( ) {
4
+ it ( 'abbr in innertext should not turn into \\n' , function ( ) {
5
+ const html = `<div>Hello <abbr>World</abbr></div>` ;
6
+ const root = parse ( html ) ;
7
+ const div = root . querySelector ( 'div' ) ;
8
+ div . innerText . should . eql ( `Hello World` ) ;
9
+ } ) ;
10
+ } ) ;
You can’t perform that action at this time.
0 commit comments