File tree Expand file tree Collapse file tree 5 files changed +141
-0
lines changed
element-with-attribute-empty-string Expand file tree Collapse file tree 5 files changed +141
-0
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,15 @@ function get_directive_type(name: string): DirectiveType {
422
422
423
423
function read_attribute_value ( parser : Parser ) {
424
424
const quote_mark = parser . eat ( "'" ) ? "'" : parser . eat ( '"' ) ? '"' : null ;
425
+ if ( quote_mark && parser . eat ( quote_mark ) ) {
426
+ return [ {
427
+ start : parser . index - 1 ,
428
+ end : parser . index - 1 ,
429
+ type : 'Text' ,
430
+ raw : '' ,
431
+ data : ''
432
+ } ] ;
433
+ }
425
434
426
435
const regex = (
427
436
quote_mark === "'" ? / ' / :
Original file line number Diff line number Diff line change
1
+ <span attr =" " ></span >
2
+ <span attr =' ' ></span >
Original file line number Diff line number Diff line change
1
+ {
2
+ "html" : {
3
+ "start" : 0 ,
4
+ "end" : 43 ,
5
+ "type" : " Fragment" ,
6
+ "children" : [
7
+ {
8
+ "start" : 0 ,
9
+ "end" : 21 ,
10
+ "type" : " Element" ,
11
+ "name" : " span" ,
12
+ "attributes" : [
13
+ {
14
+ "start" : 6 ,
15
+ "end" : 13 ,
16
+ "type" : " Attribute" ,
17
+ "name" : " attr" ,
18
+ "value" : [
19
+ {
20
+ "start" : 12 ,
21
+ "end" : 12 ,
22
+ "type" : " Text" ,
23
+ "raw" : " " ,
24
+ "data" : " "
25
+ }
26
+ ]
27
+ }
28
+ ],
29
+ "children" : []
30
+ },
31
+ {
32
+ "start" : 21 ,
33
+ "end" : 22 ,
34
+ "type" : " Text" ,
35
+ "raw" : " \n " ,
36
+ "data" : " \n "
37
+ },
38
+ {
39
+ "start" : 22 ,
40
+ "end" : 43 ,
41
+ "type" : " Element" ,
42
+ "name" : " span" ,
43
+ "attributes" : [
44
+ {
45
+ "start" : 28 ,
46
+ "end" : 35 ,
47
+ "type" : " Attribute" ,
48
+ "name" : " attr" ,
49
+ "value" : [
50
+ {
51
+ "start" : 34 ,
52
+ "end" : 34 ,
53
+ "type" : " Text" ,
54
+ "raw" : " " ,
55
+ "data" : " "
56
+ }
57
+ ]
58
+ }
59
+ ],
60
+ "children" : []
61
+ }
62
+ ]
63
+ }
64
+ }
Original file line number Diff line number Diff line change
1
+ <span attr =" foo" ></span >
2
+ <span attr =' bar' ></span >
Original file line number Diff line number Diff line change
1
+ {
2
+ "html" : {
3
+ "start" : 0 ,
4
+ "end" : 49 ,
5
+ "type" : " Fragment" ,
6
+ "children" : [
7
+ {
8
+ "start" : 0 ,
9
+ "end" : 24 ,
10
+ "type" : " Element" ,
11
+ "name" : " span" ,
12
+ "attributes" : [
13
+ {
14
+ "start" : 6 ,
15
+ "end" : 16 ,
16
+ "type" : " Attribute" ,
17
+ "name" : " attr" ,
18
+ "value" : [
19
+ {
20
+ "start" : 12 ,
21
+ "end" : 15 ,
22
+ "type" : " Text" ,
23
+ "raw" : " foo" ,
24
+ "data" : " foo"
25
+ }
26
+ ]
27
+ }
28
+ ],
29
+ "children" : []
30
+ },
31
+ {
32
+ "start" : 24 ,
33
+ "end" : 25 ,
34
+ "type" : " Text" ,
35
+ "raw" : " \n " ,
36
+ "data" : " \n "
37
+ },
38
+ {
39
+ "start" : 25 ,
40
+ "end" : 49 ,
41
+ "type" : " Element" ,
42
+ "name" : " span" ,
43
+ "attributes" : [
44
+ {
45
+ "start" : 31 ,
46
+ "end" : 41 ,
47
+ "type" : " Attribute" ,
48
+ "name" : " attr" ,
49
+ "value" : [
50
+ {
51
+ "start" : 37 ,
52
+ "end" : 40 ,
53
+ "type" : " Text" ,
54
+ "raw" : " bar" ,
55
+ "data" : " bar"
56
+ }
57
+ ]
58
+ }
59
+ ],
60
+ "children" : []
61
+ }
62
+ ]
63
+ }
64
+ }
You can’t perform that action at this time.
0 commit comments