* Create a div element with the specified CSS classes. * * @param classes array of CSS class names to add * @param parent optional parent element to append the div to * @returns the created div element * * @example * const div = Utils.createDiv(['grid-item', 'draggable']); *
(classes: string[], parent?: HTMLElement)
| 204 | * const nested = Utils.createDiv(['content'], parentDiv); |
| 205 | */ |
| 206 | static createDiv(classes: string[], parent?: HTMLElement): HTMLElement { |
| 207 | const el = document.createElement('div'); |
| 208 | classes.forEach(c => {if (c) el.classList.add(c)}); |
| 209 | parent?.appendChild(el); |
| 210 | return el; |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Check if a widget should resize to fit its content. |
no test coverage detected