diff --git a/google-map.html b/google-map.html
index 372f0d7..805675d 100644
--- a/google-map.html
+++ b/google-map.html
@@ -144,7 +144,7 @@
* @event google-map-rightclick
* @param {google.maps.MouseEvent} event The mouse event.
*/
- /**
+ /**
* Fired when the map becomes idle after panning or zooming.
* @event google-map-idle
*/
@@ -406,9 +406,9 @@
},
detached: function() {
- if (this._mutationObserver) {
- this._mutationObserver.disconnect();
- this._mutationObserver = null;
+ if (this._markersChildrenListener) {
+ this.unlisten(this.$.selector, 'items-changed', '_updateMarkers');
+ this._markersChildrenListener = null;
}
if (this._objectsMutationObserver) {
this._objectsMutationObserver.disconnect();
@@ -477,13 +477,10 @@
// watch for future updates to marker objects
_observeMarkers: function() {
// Watch for future updates.
- if (this._mutationObserver) {
+ if (this._markersChildrenListener) {
return;
}
- this._mutationObserver = new MutationObserver(this._updateMarkers.bind(this));
- this._mutationObserver.observe(this.$.selector, {
- childList: true
- });
+ this._markersChildrenListener = this.listen(this.$.selector, 'items-changed', '_updateMarkers');
},
_updateMarkers: function() {
@@ -497,7 +494,7 @@
}.bind(this));
if (added.length === 0) {
// set up observer first time around
- if (!this._mutationObserver) {
+ if (!this._markersChildrenListener) {
this._observeMarkers();
}
return;
@@ -630,7 +627,7 @@
this.map.setZoom(Number(this.zoom));
}
},
-
+
_idleEvent: function() {
if (this.map) {
this._forwardEvent('idle');
diff --git a/test/index.html b/test/index.html
index dda0e72..c5f7743 100644
--- a/test/index.html
+++ b/test/index.html
@@ -14,6 +14,7 @@
'google-map-update-pos.html',
'marker-basic.html',
'markers-add-remove.html',
+ 'markers-add-remove.html?dom=shadow',
'poly-basic.html'
]);
diff --git a/test/markers-add-remove.html b/test/markers-add-remove.html
index a20854e..55ec8bc 100644
--- a/test/markers-add-remove.html
+++ b/test/markers-add-remove.html
@@ -18,7 +18,7 @@