@@ -5,6 +5,7 @@ import Attribute from './Attribute';
5
5
export default class Slot extends Element {
6
6
type : 'Element' ;
7
7
name : string ;
8
+ slot_name : string ;
8
9
attributes : Attribute [ ] ;
9
10
children : Node [ ] ;
10
11
@@ -27,8 +28,8 @@ export default class Slot extends Element {
27
28
} ) ;
28
29
}
29
30
30
- const slot_name = attr . value [ 0 ] . data ;
31
- if ( slot_name === 'default' ) {
31
+ this . slot_name = attr . value [ 0 ] . data ;
32
+ if ( this . slot_name === 'default' ) {
32
33
component . error ( attr , {
33
34
code : `invalid-slot-name` ,
34
35
message : `default is a reserved word — it cannot be used as a slot name`
@@ -46,28 +47,13 @@ export default class Slot extends Element {
46
47
// validator.slots.add(slot_name);
47
48
} ) ;
48
49
50
+ if ( ! this . slot_name ) this . slot_name = 'default' ;
51
+
49
52
// if (node.attributes.length === 0) && validator.slots.has('default')) {
50
53
// validator.error(node, {
51
54
// code: `duplicate-slot`,
52
55
// message: `duplicate default <slot> element`
53
56
// });
54
57
// }
55
58
}
56
-
57
- get_static_attribute_value ( name : string ) {
58
- const attribute = this . attributes . find (
59
- attr => attr . name . toLowerCase ( ) === name
60
- ) ;
61
-
62
- if ( ! attribute ) return null ;
63
-
64
- if ( attribute . is_true ) return true ;
65
- if ( attribute . chunks . length === 0 ) return '' ;
66
-
67
- if ( attribute . chunks . length === 1 && attribute . chunks [ 0 ] . type === 'Text' ) {
68
- return attribute . chunks [ 0 ] . data ;
69
- }
70
-
71
- return null ;
72
- }
73
59
}
0 commit comments