File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 4040 < h2 id ="methods "> Methods</ h2 >
4141 < dl >
4242 < dt > dismiss()</ dt >
43- < dd > Dismisses the alert.</ dd >
43+ < dd > Dismiss the alert (removes element from the DOM).</ dd >
44+ </ dl >
45+ < dl >
46+ < dt > submit()</ dt >
47+ < dd > Simulates a mouse click on the CTA.</ dd >
4448 </ dl >
4549 </ section >
4650{% endblock %}
Original file line number Diff line number Diff line change @@ -166,26 +166,32 @@ export class HXAlertElement extends HXElement {
166166 }
167167
168168 /**
169- * Programmatically dismiss the alert (removes element from the DOM).
169+ * Dismiss the alert (removes element from the DOM).
170170 */
171171 dismiss ( ) {
172- this . remove ( ) ;
172+ if ( this . $emit ( 'dismiss' ) ) {
173+ // only if event was not canceled by consumer
174+ this . remove ( ) ;
175+ }
176+ }
177+
178+ /**
179+ * Simulate a mouse click on the CTA button.
180+ */
181+ submit ( ) {
182+ this . $emit ( 'submit' ) ;
173183 }
174184
175185 /** @private */
176186 _onDismiss ( evt ) {
177187 evt . preventDefault ( ) ;
178-
179- if ( this . $emit ( 'dismiss' ) ) {
180- // only if event was not canceled by consumer
181- this . dismiss ( ) ;
182- }
188+ this . dismiss ( ) ;
183189 }
184190
185191 /** @private */
186192 _onSubmit ( evt ) {
187193 evt . preventDefault ( ) ;
188- this . $emit ( ' submit' ) ;
194+ this . submit ( ) ;
189195 }
190196
191197 /** @private */
You can’t perform that action at this time.
0 commit comments