@@ -2,15 +2,17 @@ const path = require('path');
2
2
const { CompositeDisposable } = require ( 'event-kit' ) ;
3
3
4
4
class PaneElement extends HTMLElement {
5
- createdCallback ( ) {
5
+ constructor ( ) {
6
+ super ( ) ;
6
7
this . attached = false ;
7
8
this . subscriptions = new CompositeDisposable ( ) ;
8
9
this . inlineDisplayStyles = new WeakMap ( ) ;
9
- this . initializeContent ( ) ;
10
10
this . subscribeToDOMEvents ( ) ;
11
+ this . itemViews = document . createElement ( 'div' ) ;
11
12
}
12
13
13
- attachedCallback ( ) {
14
+ connectedCallback ( ) {
15
+ this . initializeContent ( ) ;
14
16
this . attached = true ;
15
17
if ( this . model . isFocused ( ) ) {
16
18
this . focus ( ) ;
@@ -24,7 +26,6 @@ class PaneElement extends HTMLElement {
24
26
initializeContent ( ) {
25
27
this . setAttribute ( 'class' , 'pane' ) ;
26
28
this . setAttribute ( 'tabindex' , - 1 ) ;
27
- this . itemViews = document . createElement ( 'div' ) ;
28
29
this . appendChild ( this . itemViews ) ;
29
30
this . itemViews . setAttribute ( 'class' , 'item-views' ) ;
30
31
}
@@ -148,6 +149,7 @@ class PaneElement extends HTMLElement {
148
149
} ) ;
149
150
}
150
151
}
152
+
151
153
if ( ! this . itemViews . contains ( itemView ) ) {
152
154
this . itemViews . appendChild ( itemView ) ;
153
155
}
@@ -213,6 +215,12 @@ class PaneElement extends HTMLElement {
213
215
}
214
216
}
215
217
216
- module . exports = document . registerElement ( 'atom-pane' , {
217
- prototype : PaneElement . prototype
218
- } ) ;
218
+ function createPaneElement ( ) {
219
+ return document . createElement ( 'atom-pane' ) ;
220
+ }
221
+
222
+ window . customElements . define ( 'atom-pane' , PaneElement ) ;
223
+
224
+ module . exports = {
225
+ createPaneElement
226
+ } ;
0 commit comments