@@ -6,9 +6,10 @@ VALUE = "value"; // exported: defined here but not handled here
66// =============================================================================
77// The custom base class, direct sub-class of HTMLElement
88class BaseElement extends HTMLElement {
9- #connected; #disabled; #disabling; #id; #meta; #ptrEvents; #tabIndex;
9+ #connected; #disabled; #disabling; #id; #internals ; # meta; #ptrEvents; #tabIndex;
1010 static searchParams ; // set by html-elements.js, if it's used
1111 static observedAttributes = [ DISABLED , TAB_INDEX ] ;
12+ static formAssociated = true ;
1213 static promises = new Map ; // for noAwait, see https://github.com/sidewayss/html-elements/issues/8
1314 constructor ( meta , template , noAwait ) {
1415 super ( ) ;
@@ -21,15 +22,17 @@ class BaseElement extends HTMLElement {
2122 this . #attach( template ) ; // <template> as DocumentFragment
2223
2324 this . setAttribute ( TAB_INDEX , "0" ) ; // default value emulates <input>
25+ this . #internals = this . attachInternals ( ) ; // for accessibility, labels
2426 }
2527 #attach( template ) {
2628 this . _dom = this . attachShadow ( { mode :"open" } ) ;
2729 this . _dom . appendChild ( template . cloneNode ( true ) ) ;
2830 }
29- // connectedCallback() exists for noAwait. It calls this._init(), which resides
30- // in the bottom-level class. Classes with intermediate superclasses might call
31- // this._initSuper(). If (!noAwait) it must call a pseudo-connectedCallback()
32- // because a real one prevents this one from running.
31+ // connectedCallback() exists for DISABLED and noAwait. It calls this._init(),
32+ // which resides in the bottom-level class. Classes with intermediate super-
33+ // classes might call this._initSuper(). If (!noAwait) it must call a pseudo-
34+ // connectedCallback() called _connected(), because a real one prevents this
35+ // one from running.
3336 connectedCallback ( ) {
3437 if ( this . #meta) {
3538 getTemplate ( this . #meta, this . #id) . then ( tmp => {
0 commit comments