|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> |
| 6 | + <title>map-extent mutation observer bug #952</title> |
| 7 | + <script type="module" src="mapml-viewer.js"></script> |
| 8 | + <style> |
| 9 | + html, |
| 10 | + body { |
| 11 | + height: 100%; |
| 12 | + } |
| 13 | + * { |
| 14 | + margin: 0; |
| 15 | + padding: 0; |
| 16 | + } |
| 17 | + |
| 18 | + /* Specifying the `:defined` selector is recommended to style the map |
| 19 | + element, such that styles don't apply when fallback content is in use |
| 20 | + (e.g. when scripting is disabled or when custom/built-in elements isn't |
| 21 | + supported in the browser). */ |
| 22 | + mapml-viewer:defined { |
| 23 | + /* Responsive map. */ |
| 24 | + max-width: 100%; |
| 25 | + |
| 26 | + /* Full viewport. */ |
| 27 | + width: 100%; |
| 28 | + height: 100%; |
| 29 | + |
| 30 | + /* Remove default (native-like) border. */ |
| 31 | + border: none; |
| 32 | + |
| 33 | + vertical-align: middle; |
| 34 | + } |
| 35 | + |
| 36 | + /* Pre-style to avoid FOUC of inline layer- and fallback content. */ |
| 37 | + mapml-viewer:not(:defined) > * { |
| 38 | + display: none; |
| 39 | + } |
| 40 | + |
| 41 | + /* Pre-style to avoid Layout Shift. */ |
| 42 | + mapml-viewer:not(:defined) { |
| 43 | + display: inline-block; |
| 44 | + contain: size; |
| 45 | + contain-intrinsic-size: 304px 154px; |
| 46 | + } |
| 47 | + |
| 48 | + /* Ensure inline layer content is hidden if custom/built-in elements isn't |
| 49 | + supported, or if javascript is disabled. This needs to be defined separately |
| 50 | + from the above, because the `:not(:defined)` selector invalidates the entire |
| 51 | + declaration in browsers that do not support it. */ |
| 52 | + layer- { |
| 53 | + display: none; |
| 54 | + } |
| 55 | + </style> |
| 56 | + <noscript> |
| 57 | + <style> |
| 58 | + /* Ensure fallback content (children of the map element) is displayed if |
| 59 | + custom/built-in elements is supported but javascript is disabled. */ |
| 60 | + mapml-viewer:not(:defined) > :not(layer-) { |
| 61 | + display: initial; |
| 62 | + } |
| 63 | + |
| 64 | + /* "Reset" the properties used to pre-style (to avoid Layout Shift) if |
| 65 | + custom/built-in elements is supported but javascript is disabled. */ |
| 66 | + mapml-viewer:not(:defined) { |
| 67 | + display: initial; |
| 68 | + contain: initial; |
| 69 | + contain-intrinsic-size: initial; |
| 70 | + } |
| 71 | + </style> |
| 72 | + </noscript> |
| 73 | + </head> |
| 74 | + <body> |
| 75 | + |
| 76 | + <mapml-viewer data-testid="viewer" projection="OSMTILE" zoom="2" lat="50.7" lon="-84.4" controls> |
| 77 | + <layer- data-testid="problem-layer" label="Countries" checked> |
| 78 | + <map-link rel="stylesheet" href="tiles/vector-tile.css" ></map-link> |
| 79 | + <map-extent units="OSMTILE" checked hidden> |
| 80 | + <map-meta name='zoom' content="min=0,max=6"></map-meta> |
| 81 | + <map-input name="zoomLevel" type="zoom" min="0" max="2" value="6"></map-input> |
| 82 | + <map-input name="row" type="location" axis="row" units="tilematrix" min="20" max="23"></map-input> |
| 83 | + <map-input name="col" type="location" axis="column" units="tilematrix" min="15" max="19"></map-input> |
| 84 | + <map-link data-testid="templated-link" rel='tile' type='text/mapml' tref='tiles/osmtile/{zoomLevel}/{row}/{col}.mapml' ></map-link> </map-extent> |
| 85 | + </layer-> |
| 86 | + </mapml-viewer> |
| 87 | + </body> |
| 88 | +</html> |
0 commit comments