Skip to content

Commit bb19e81

Browse files
committed
Remove prefers-map-content hardcoded demo hack tbd broken tests
1 parent d5a356b commit bb19e81

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

src/layer.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ export class BaseLayerElement extends HTMLElement {
168168
// this._opacity is used to record the current opacity value (with or without updates),
169169
// the initial value of this._opacity should be set as opacity attribute value, if exists, or the default value 1.0
170170
this._opacity = this.opacity || 1.0;
171-
this._renderingMapContent = M.options.contentPreference;
172171
this.attachShadow({ mode: 'open' });
173172
}
174173
disconnectedCallback() {
@@ -297,7 +296,6 @@ export class BaseLayerElement extends HTMLElement {
297296
.then(() => {
298297
// may throw:
299298
this.selectAlternateOrChangeProjection();
300-
this.checkForPreferredContent();
301299
})
302300
.then(() => {
303301
this._layer = mapMLLayer(new URL(this.src, base).href, this, {
@@ -335,7 +333,6 @@ export class BaseLayerElement extends HTMLElement {
335333
.then(() => {
336334
// may throw:
337335
this.selectAlternateOrChangeProjection();
338-
this.checkForPreferredContent();
339336
})
340337
.then(() => {
341338
this._layer = mapMLLayer(null, this, {
@@ -374,13 +371,6 @@ export class BaseLayerElement extends HTMLElement {
374371
);
375372
this.parentElement.projection = e.cause.mapprojection;
376373
}
377-
} else if (e.message === 'findmatchingpreferredcontent') {
378-
if (e.cause.href) {
379-
console.log(
380-
'Changing layer to matching preferred content at: ' + e.cause.href
381-
);
382-
this.src = e.cause.href;
383-
}
384374
} else if (e.message === 'Failed to fetch') {
385375
// cut short whenReady with the _fetchError property
386376
this._fetchError = true;
@@ -429,23 +419,6 @@ export class BaseLayerElement extends HTMLElement {
429419
}
430420
}
431421

432-
checkForPreferredContent() {
433-
let mapml = this.src ? this.shadowRoot : this;
434-
let availablePreferMapContents = mapml.querySelector(
435-
`map-link[rel="style"][media="prefers-map-content=${this._renderingMapContent}"][href]`
436-
);
437-
if (availablePreferMapContents) {
438-
// resolve href
439-
let url = new URL(
440-
availablePreferMapContents.getAttribute('href'),
441-
availablePreferMapContents.getBase()
442-
).href;
443-
throw new Error('findmatchingpreferredcontent', {
444-
cause: { href: url }
445-
});
446-
}
447-
}
448-
449422
copyRemoteContentToShadowRoot(mapml) {
450423
let shadowRoot = this.shadowRoot;
451424
// get the map-meta[name=projection/cs/extent/zoom] from map-head of remote mapml, attach them to the shadowroot

0 commit comments

Comments
 (0)