* Prepares DOMElements and adds correct className to the root element. * * @private
()
| 284 | * @private |
| 285 | */ |
| 286 | createElements() { |
| 287 | const { rootElement, rootDocument } = this.hot; |
| 288 | const originalStyle = rootElement.getAttribute('style'); |
| 289 | |
| 290 | if (originalStyle) { |
| 291 | rootElement.dataset.originalstyle = originalStyle; // needed to retrieve original style in jsFiddle link generator in HT examples. may be removed in future versions |
| 292 | } |
| 293 | |
| 294 | addClass(rootElement, 'handsontable'); |
| 295 | |
| 296 | this.#table = rootDocument.createElement('table'); |
| 297 | addClass(this.#table, 'htCore'); |
| 298 | |
| 299 | if (this.hot.getSettings().tableClassName) { |
| 300 | addClass(this.#table, this.hot.getSettings().tableClassName!); |
| 301 | } |
| 302 | |
| 303 | if (this.settings.ariaTags) { |
| 304 | setAttribute(this.#table, [ |
| 305 | A11Y_PRESENTATION() |
| 306 | ]); |
| 307 | |
| 308 | setAttribute(rootElement, [ |
| 309 | A11Y_TREEGRID(), |
| 310 | A11Y_ROWCOUNT(-1), |
| 311 | A11Y_COLCOUNT(this.hot.countCols()), |
| 312 | A11Y_MULTISELECTABLE(), |
| 313 | ]); |
| 314 | } |
| 315 | |
| 316 | this.THEAD = rootDocument.createElement('thead'); |
| 317 | this.#table.appendChild(this.THEAD); |
| 318 | |
| 319 | this.TBODY = rootDocument.createElement('tbody'); |
| 320 | this.#table.appendChild(this.TBODY); |
| 321 | |
| 322 | this.hot.table = this.#table; |
| 323 | |
| 324 | this.hot.container.insertBefore(this.#table, this.hot.container.firstChild); |
| 325 | } |
| 326 | |
| 327 | /** |
| 328 | * Attaches necessary listeners. |
no test coverage detected