Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 041f1aa

Browse files
Adrián González Rusadrigzr
authored andcommitted
fix: remove rootElement div
1 parent d336ce2 commit 041f1aa

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

addon/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,10 @@ function initializeCustomElement(elementName, { name: componentName, attributes:
135135

136136
const self = this;
137137
const shadow = this.attachShadow({ mode: 'open' });
138-
const rootElement = document.createElement('div');
139138
const eventDispatcher = owner.factoryFor('event_dispatcher:main').create();
140139

141140
// Hack to fix event_dispatcher need of a parent with classList.
142-
shadow.classList = rootElement.classList;
141+
shadow.classList = this.classList;
143142

144143
if (options.onConnect) {
145144
options.onConnect.call(self);
@@ -154,11 +153,11 @@ function initializeCustomElement(elementName, { name: componentName, attributes:
154153

155154
self.context = controller;
156155

157-
toplevelView.appendTo(rootElement);
156+
toplevelView.appendTo(shadow);
158157

159-
shadow.appendChild(rootElement);
160-
161-
eventDispatcher.setup(null, rootElement);
158+
schedule('afterRender', () => {
159+
eventDispatcher.setup(null, shadow.children[0]);
160+
});
162161

163162
if (options.onRender) {
164163
options.onRender.call(self);

0 commit comments

Comments
 (0)