File tree 2 files changed +6
-16
lines changed
2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -78,26 +78,16 @@ class EventHandler {
78
78
}
79
79
80
80
/**
81
- * Converts event name into attribute. Event named 'someCustomEvent' needs to
82
- * be transformed into on-some-custom-event.
81
+ * Converts event name into attribute name.
83
82
*/
84
- static String eventNameToAttrName (String eventName) {
85
- var part = eventName.replaceAllMapped (new RegExp ("([A-Z])" ), (Match match) {
86
- return '-${match .group (0 ).toLowerCase ()}' ;
87
- });
88
- return 'on-${part }' ;
89
- }
83
+ static String eventNameToAttrName (String eventName) => 'on-$eventName ' ;
90
84
91
85
/**
92
- * Converts attribute into event name. Attribute 'on-some-custom-event'
93
- * corresponds to event named 'someCustomEvent'.
86
+ * Converts attribute name into event name.
94
87
*/
95
88
static String attrNameToEventName (String attrName) {
96
- var part = attrName.startsWith ("on-" ) ? attrName.substring (3 ) : attrName;
97
- part = part.replaceAllMapped (new RegExp (r'\-(\w)' ), (Match match) {
98
- return match.group (0 ).toUpperCase ();
99
- });
100
- return part.replaceAll ("-" , "" );
89
+ assert (attrName.startsWith ('on-' ));
90
+ return attrName.substring (3 );
101
91
}
102
92
}
103
93
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ main() {
50
50
var e = compile (_,
51
51
'''<div on-my-new-event="invoked=true;"></div>''' );
52
52
53
- _.triggerEvent (e, 'myNewEvent ' );
53
+ _.triggerEvent (e, 'my-new-event ' );
54
54
expect (_.rootScope.context['invoked' ]).toEqual (true );
55
55
});
56
56
You can’t perform that action at this time.
0 commit comments