File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -56,26 +56,24 @@ export abstract class BaseComponent<T extends Element> {
5656 /**
5757 * Insert component after the last child
5858 */
59- public append ( component ?: BaseComponent < any > | null ) {
60- if ( ! component ) return this ;
61- this . element . appendChild ( component . element ) ;
59+ public append ( ...components : BaseComponent < any > [ ] ) {
60+ components . map ( ( component ) => this . element . appendChild ( component . element ) )
6261 return this ;
6362 }
6463
6564 /**
6665 * Insert component before the first child
6766 */
68- public prepend ( component ?: BaseComponent < any > | null ) {
69- if ( ! component ) return this ;
70- this . element . prepend ( component . element ) ;
67+ public prepend ( ...components : BaseComponent < any > [ ] ) {
68+ components . map ( ( component ) => this . element . appendChild ( component . element ) )
7169 return this ;
7270 }
7371
7472 /**
7573 * Add classes
7674 */
7775 public class ( ...classes : string [ ] ) {
78- this . element . classList . add ( ...classes . flatMap ( c => c . split ( " " ) ) ) ;
76+ this . element . classList . add ( ...classes . flatMap ( c => c . split ( " " ) ) ) ;
7977 return this ;
8078 }
8179
You can’t perform that action at this time.
0 commit comments