You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Mutation observer does not pick up changes with native shadow DOM #299
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 <content> tag. The content tag doesn't change and we never get to 496 this._attachChildrenToMap(this.markers); which just sets the map object in the google-map-marker.
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:
(changes @vaadin-marcus sample jsbin)
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. <google-map-marker map="[[map]]" latitude="[[item.lat]]" longitude="[[item.lon]]">This is static text, so this will populate the info window.</google-map-marker>
Data binding will not work to populate the info window. <google-map-marker map="[[map]]" latitude="[[item.lat]]" longitude="[[item.lon]]">[[item.description]]</google-map-marker>
I also discovered that Streets view does not work at all with the native shadow DOM.
+1 for @MoonDawg92
I also have the same issue. After adding the markers dynamically from database(simulated with setTimeout), the map doesn't resize. https://jsbin.com/jusara/edit?html,output
map="[[map]]" doesn't work for me, it doesn't redraw my polylines when data changes..
And it doesn't fit to markers when data changes either.
What am I doing wrong?
@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 <google-map> element doesn't change the markers. And I did call render() in an async loop with setInterval() but it didn't change the result.
The map still doesn't update when the google-map-points change..
Activity
mlisook commentedon Jun 14, 2016
+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
<content>tag. The content tag doesn't change and we never get to496 this._attachChildrenToMap(this.markers);which just sets the map object in the google-map-marker.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:
(changes @vaadin-marcus sample jsbin)
which does seem to work in both shadow and shady. See JS Bin workaround http://jsbin.com/gedulog/edit?html,output
mlisook commentedon Jun 15, 2016
BTW even the minimal functionality test in /test/markers-add-remove.html fails if you use shadow dom.
TheMoonDawg commentedon Jul 13, 2016
+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.
TheMoonDawg commentedon Jul 14, 2016
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.
<google-map-marker map="[[map]]" latitude="[[item.lat]]" longitude="[[item.lon]]">This is static text, so this will populate the info window.</google-map-marker>Data binding will not work to populate the info window.
<google-map-marker map="[[map]]" latitude="[[item.lat]]" longitude="[[item.lon]]">[[item.description]]</google-map-marker>I also discovered that Streets view does not work at all with the native shadow DOM.
ibhi commentedon Jul 31, 2016
+1 for @MoonDawg92
I also have the same issue. After adding the markers dynamically from database(simulated with setTimeout), the map doesn't resize. https://jsbin.com/jusara/edit?html,output
ziszo commentedon Sep 5, 2016
Whenever the dom-repeat items changed, some of the info window has the same content as the old items.
Boscop commentedon Oct 27, 2017
map="[[map]]"doesn't work for me, it doesn't redraw my polylines when data changes..And it doesn't fit to markers when data changes either.
What am I doing wrong?
ziszo commentedon Oct 29, 2017
@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.
Boscop commentedon Nov 5, 2017
But what does it help to be able to observe the marker changes? The
<google-map>element doesn't change the markers. And I did callrender()in an async loop withsetInterval()but it didn't change the result.The map still doesn't update when the google-map-points change..