File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -460,10 +460,10 @@ export class HTMLElement extends Node {
460
460
return this . _rawAttrs ;
461
461
const attrs = { } as RawAttributes ;
462
462
if ( this . rawAttrs ) {
463
- const re = / \b ( [ a - z ] [ a - z 0 - 9 \- ] * ) \s * = \s * ( " ( [ ^ " ] + ) " | ' ( [ ^ ' ] + ) ' | ( \S + ) ) / ig;
463
+ const re = / \b ( [ a - z ] [ a - z 0 - 9 \- ] * ) (?: \s * = \s * (?: " ( [ ^ " ] + ) " | ' ( [ ^ ' ] + ) ' | ( \S + ) ) ) ? / ig;
464
464
let match : RegExpExecArray ;
465
465
while ( match = re . exec ( this . rawAttrs ) ) {
466
- attrs [ match [ 1 ] ] = match [ 3 ] || match [ 4 ] || match [ 5 ] ;
466
+ attrs [ match [ 1 ] ] = match [ 2 ] || match [ 3 ] || match [ 4 ] || "" ;
467
467
}
468
468
}
469
469
this . _rawAttrs = attrs ;
Original file line number Diff line number Diff line change @@ -264,11 +264,12 @@ describe('HTML Parser', function () {
264
264
265
265
describe ( '#attributes' , function ( ) {
266
266
it ( 'should return attributes of the element' , function ( ) {
267
- var root = parseHTML ( '<p a=12 data-id="!$$&" yAz=\'1\'></p>' ) ;
267
+ var root = parseHTML ( '<p a=12 data-id="!$$&" yAz=\'1\' disabled ></p>' ) ;
268
268
root . firstChild . attributes . should . eql ( {
269
269
'a' : '12' ,
270
270
'data-id' : '!$$&' ,
271
- 'yAz' : '1'
271
+ 'yAz' : '1' ,
272
+ 'disabled' : ''
272
273
} ) ;
273
274
} ) ;
274
275
} ) ;
You can’t perform that action at this time.
0 commit comments