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

Method attributeChangedCallback

src/map-link.js:186–262  ·  view source on GitHub ↗
(name, oldValue, newValue)

Source from the content-addressed store, hash-verified

184 }
185
186 attributeChangedCallback(name, oldValue, newValue) {
187 //['type','rel','href','hreflang','tref','tms','projection'];
188 // fold to lowercase
189 if (this.#hasConnected /* jshint ignore:line */) {
190 switch (name) {
191 case 'type':
192 // rel = tile, features, etc. TBD when it is used
193 // ttype = !t.hasAttribute('type')
194 // ? 'image/*'
195 // : t.getAttribute('type').toLowerCase(),
196
197 if (oldValue !== newValue) {
198 // default value image/*
199 // handle side effects
200 }
201 break;
202 case 'rel':
203 // mandatory attribute, no default value
204 if (oldValue !== newValue) {
205 // handle side effects
206 if (newValue === 'query') {
207 }
208 }
209 break;
210 // case 'title':
211 // if (oldValue !== newValue) {
212 // // handle side effects
213 // }
214 // break;
215 case 'href':
216 // rel = license, legend, stylesheet, self, style, self style, style self, zoomin, zoomout
217 if (oldValue !== newValue) {
218 // handle side effects
219 }
220 break;
221 case 'hreflang':
222 // rel = *all*
223 // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang
224 // idea is that we can have multiple map-links with different hreflang, and map-extent chooses a map-link that matches with user's lang. Not a priority. - create an use-case issue?
225 if (oldValue !== newValue) {
226 // handle side effects
227 }
228 break;
229 case 'tref':
230 // rel = tile, image, features, query
231 if (oldValue !== newValue) {
232 // create or reset the _templateVars property
233 this._initTemplateVars();
234 }
235 break;
236 case 'media':
237 if (oldValue !== newValue) {
238 this._registerMediaQuery(newValue);
239 }
240 break;
241 case 'tms':
242 // rel = tile
243 if (oldValue !== newValue) {

Callers

nothing calls this directly

Calls 4

_initTemplateVarsMethod · 0.95
_registerMediaQueryMethod · 0.95
_disableLinkMethod · 0.95
_enableLinkMethod · 0.95

Tested by

no test coverage detected