-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutation observer does not pick up changes with native shadow DOM #299
Comments
+1 for @vaadin-marcus ... As far as I can tell, what's happening is the mutationObserver at google-map.html 468-470:
is watching an iron-selector that refers to the markers, not the markers themselves. In shady dom the iron-selector's direct children are the google-map-markers. In shadow dom there is just one direct child, the Since all this serpentine code is just setting the map on the google-map-marker, for now a workaround may be to just data bind it in:
which does seem to work in both shadow and shady. See JS Bin workaround http://jsbin.com/gedulog/edit?html,output |
BTW even the minimal functionality test in /test/markers-add-remove.html fails if you use shadow dom. |
+1 for mlisook! I have markers being dynamically added from data returned from our database. Whenever the map finished rendering before the markers, they never showed up. Your workaround did the trick! However, the map doesn't seem to resize correctly around the new markers. For right now, I've just been settings the map's lon/lat to focus around the first marker. |
mlisook's workaround unfortunately does not work for the info window text if we use data binding to populate it. This will populate the info window because it's static. Data binding will not work to populate the info window. I also discovered that Streets view does not work at all with the native shadow DOM. |
+1 for @MoonDawg92 |
Whenever the dom-repeat items changed, some of the info window has the same content as the old items. |
<google-map id="gmap" map="{{map}}" fit-to-markers api-key="foo">
<template is="dom-repeat" items="[[places_res]]" as="place">
<google-map-marker map="[[map]]" latitude="[[place.latitude]]" longitude="[[place.longitude]]"
title="[[place.unique_id]]"
icon="https://maps.google.com/mapfiles/ms/icons/blue-dot.png"
>
</google-map-marker>
</template>
<template is="dom-repeat" items="[[trucks_res]]" as="truck">
<google-map-marker map="[[map]]" latitude="[[truck.location.latitude]]" longitude="[[truck.location.longitude]]"
title="[[truck.unique_id]]: [[truck.driver_name]]"
icon="/images/truck.png"
>
</google-map-marker>
<template is="dom-repeat" items="[[trucks_res]]" as="truck">
<google-map-poly map="[[map]]" stroke-color="blue" fill-opacity=".5">
<google-map-point map="[[map]]" latitude="[[truck.location.latitude]]" longitude="[[truck.location.longitude]]"></google-map-point>
<template is="dom-repeat" items="[[truck.route]]" as="location">
<google-map-point map="[[map]]" latitude="[[location.latitude]]" longitude="[[location.longitude]]"></google-map-point>
</template>
</google-map-poly>
</template>
</template>
</google-map> |
@Boscop: I moved google-map folder from bower_components into a separate folder in src. Then modified the google-map element's code instead. I can't trace the changes I made anymore, but what I can remember: I changed the markers property's notify to true so I can observe the markers from the element where I included the google-map. Just make sure that you don't import google-map from bower_components folder so it will not result to element duplicate definition. If changing the property that you need to observe won't do, try to render() the dom-repeat that you have. |
But what does it help to be able to observe the marker changes? The The map still doesn't update when the google-map-points change.. |
It seems that with native Shadow DOM enabled, markers added to a map with a
<dom-repeat>
do not get picked up. With shady DOM, it works as expected.Here is a JS Bin showing the issue: http://jsbin.com/sufexuhoba/edit?html,output
The text was updated successfully, but these errors were encountered: