@@ -159,7 +159,11 @@ export default class HTMLElement extends Node {
159
159
return 'null' ;
160
160
}
161
161
162
- return JSON . stringify ( attr . replace ( / " / g, '"' ) ) . replace ( / \\ t / g, '\t' ) . replace ( / \\ n / g, '\n' ) . replace ( / \\ r / g, '\r' ) . replace ( / \\ / g, '' ) ;
162
+ return JSON . stringify ( attr . replace ( / " / g, '"' ) )
163
+ . replace ( / \\ t / g, '\t' )
164
+ . replace ( / \\ n / g, '\n' )
165
+ . replace ( / \\ r / g, '\r' )
166
+ . replace ( / \\ / g, '' ) ;
163
167
}
164
168
165
169
/**
@@ -373,11 +377,7 @@ export default class HTMLElement extends Node {
373
377
return child === this ;
374
378
} ) ;
375
379
resetParent ( [ this ] , null ) ;
376
- parent . childNodes = [
377
- ...parent . childNodes . slice ( 0 , idx ) ,
378
- ...resetParent ( content , parent ) ,
379
- ...parent . childNodes . slice ( idx + 1 ) ,
380
- ] ;
380
+ parent . childNodes = [ ...parent . childNodes . slice ( 0 , idx ) , ...resetParent ( content , parent ) , ...parent . childNodes . slice ( idx + 1 ) ] ;
381
381
return this ;
382
382
}
383
383
@@ -456,10 +456,12 @@ export default class HTMLElement extends Node {
456
456
this . childNodes . length = o ;
457
457
458
458
// remove whitespace between attributes
459
- const attrs = Object . keys ( this . rawAttributes ) . map ( ( key ) => {
460
- const val = this . rawAttributes [ key ] ;
461
- return `${ key } =${ JSON . stringify ( val ) } ` ;
462
- } ) . join ( ' ' ) ;
459
+ const attrs = Object . keys ( this . rawAttributes )
460
+ . map ( ( key ) => {
461
+ const val = this . rawAttributes [ key ] ;
462
+ return `${ key } =${ JSON . stringify ( val ) } ` ;
463
+ } )
464
+ . join ( ' ' ) ;
463
465
this . rawAttrs = attrs ;
464
466
delete this . _rawAttrs ;
465
467
return this ;
@@ -565,7 +567,7 @@ export default class HTMLElement extends Node {
565
567
if ( child . nodeType === NodeType . ELEMENT_NODE ) {
566
568
if ( child . id === id ) {
567
569
return child ;
568
- } ;
570
+ }
569
571
570
572
// if children are existing push the current status to the stack and keep searching for elements in the level below
571
573
if ( child . childNodes . length > 0 ) {
@@ -686,7 +688,7 @@ export default class HTMLElement extends Node {
686
688
}
687
689
const attrs = { } as RawAttributes ;
688
690
if ( this . rawAttrs ) {
689
- const re = / ( [ a - z A - Z ( ) [ \] # @ $ . ? : ] [ a - z A - Z 0 - 9 - _ : ( ) [ \] # ] * ) (?: \s * = \s * ( (?: ' [ ^ ' ] * ' ) | (?: " [ ^ " ] * " ) | \S + ) ) ? / g;
691
+ const re = / ( [ a - z A - Z ( ) \ [\] # @ $ . ? : ] [ a - z A - Z 0 - 9 - . _ : ( ) [ \] # ] * ) (?: \s * = \s * ( (?: ' [ ^ ' ] * ' ) | (?: " [ ^ " ] * " ) | \S + ) ) ? / g;
690
692
let match : RegExpExecArray ;
691
693
while ( ( match = re . exec ( this . rawAttrs ) ) ) {
692
694
const key = match [ 1 ] ;
@@ -1023,7 +1025,7 @@ export interface Options {
1023
1025
* void tag serialisation, add a final slash <br/>
1024
1026
*/
1025
1027
closingSlash ?: boolean ;
1026
- }
1028
+ } ;
1027
1029
}
1028
1030
1029
1031
const frameflag = 'documentfragmentcontainer' ;
@@ -1109,7 +1111,7 @@ export function base_parse(data: string, options = {} as Partial<Options>) {
1109
1111
if ( ! leadingSlash ) {
1110
1112
/* Populate attributes */
1111
1113
const attrs = { } as Record < string , string > ;
1112
- for ( let attMatch ; ( attMatch = kAttributePattern . exec ( attributes ) ) ; ) {
1114
+ for ( let attMatch ; ( attMatch = kAttributePattern . exec ( attributes ) ) ; ) {
1113
1115
const { 1 : key , 2 : val } = attMatch ;
1114
1116
const isQuoted = val [ 0 ] === `'` || val [ 0 ] === `"` ;
1115
1117
attrs [ key . toLowerCase ( ) ] = isQuoted ? val . slice ( 1 , val . length - 1 ) : val ;
@@ -1247,7 +1249,7 @@ export function parse(data: string, options = {} as Partial<Options>) {
1247
1249
* and removes nodes from any potential parent.
1248
1250
*/
1249
1251
function resolveInsertable ( insertable : NodeInsertable [ ] ) : Node [ ] {
1250
- return insertable . map ( val => {
1252
+ return insertable . map ( ( val ) => {
1251
1253
if ( typeof val === 'string' ) {
1252
1254
return new TextNode ( val ) ;
1253
1255
}
0 commit comments