File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ export class HXElement extends HTMLElement {
111111 this . _$tabIndex = this . getAttribute ( 'tabindex' ) ;
112112 this . $upgradeProperty ( 'disabled' ) ;
113113 this . setAttribute ( 'hx-defined' , '' ) ;
114+ this . _$styleElement ( ) ;
114115 this . $onConnect ( ) ;
115116 }
116117
@@ -317,10 +318,23 @@ export class HXElement extends HTMLElement {
317318 if ( this . constructor . template ) {
318319 let _template = this . _$prepareTemplate ( this . constructor . template ) ;
319320 this . attachShadow ( { mode : 'open' } ) ;
320- if ( window . ShadyCSS ) {
321- ShadyCSS . styleElement ( this ) ;
322- }
323321 this . shadowRoot . appendChild ( _template . content . cloneNode ( true ) ) ;
324322 }
325323 } //_$setupShadowDOM()
324+
325+ /**
326+ * @description
327+ * Style the element using ShadyCSS, if needed.
328+ *
329+ * @note : has the potential to modify the `[class]` attribute
330+ * of the element, so avoid running in the constructor.
331+ */
332+ _$styleElement ( ) {
333+ // short circuit if browser natively supports ShadowDOM
334+ if ( ! window . ShadyCSS ) {
335+ return ;
336+ }
337+
338+ ShadyCSS . styleElement ( this ) ;
339+ }
326340}
You can’t perform that action at this time.
0 commit comments