MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / connectedCallback

Method connectedCallback

src/mapml-viewer.js:180–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178 this._traversalCall = false;
179 }
180 connectedCallback() {
181 this.whenProjectionDefined(this.projection)
182 .then(() => {
183 this._setLocale();
184 this._initShadowRoot();
185
186 this._controlsList = new DOMTokenList(
187 this.getAttribute('controlslist'),
188 this,
189 'controlslist',
190 [
191 'noreload',
192 'nofullscreen',
193 'nozoom',
194 'nolayer',
195 'noscale',
196 'geolocation'
197 ]
198 );
199
200 var s = window.getComputedStyle(this),
201 wpx = s.width,
202 hpx = s.height,
203 w = this.hasAttribute('width')
204 ? this.getAttribute('width')
205 : parseInt(wpx.replace('px', '')),
206 h = this.hasAttribute('height')
207 ? this.getAttribute('height')
208 : parseInt(hpx.replace('px', ''));
209 this._changeWidth(w);
210 this._changeHeight(h);
211
212 this._createMap();
213
214 // https://github.com/Maps4HTML/MapML.js/issues/274
215 this.setAttribute('role', 'application');
216 this._toggleStatic();
217
218 /*
219 1. only deletes aria-label when the last (only remaining) map caption is removed
220 2. only deletes aria-label if the aria-label was defined by the map caption element itself
221 */
222
223 let mapcaption = this.querySelector('map-caption');
224
225 if (mapcaption !== null) {
226 setTimeout(() => {
227 let ariaupdate = this.getAttribute('aria-label');
228
229 if (ariaupdate === mapcaption.innerHTML) {
230 this.mapCaptionObserver = new MutationObserver((m) => {
231 let mapcaptionupdate = this.querySelector('map-caption');
232 if (mapcaptionupdate !== mapcaption) {
233 this.removeAttribute('aria-label');
234 }
235 });
236 this.mapCaptionObserver.observe(this, {
237 childList: true

Callers

nothing calls this directly

Calls 10

whenProjectionDefinedMethod · 0.95
_setLocaleMethod · 0.95
_initShadowRootMethod · 0.95
_changeWidthMethod · 0.95
_changeHeightMethod · 0.95
_createMapMethod · 0.95
_toggleStaticMethod · 0.95
getAttributeMethod · 0.80
replaceMethod · 0.80
setAttributeMethod · 0.80

Tested by

no test coverage detected