Fix issue 299 MutationObserver for markers in Shadow DOM #306
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In issue #299 it is observed that changes to the google-map-marker collection are not picked up by the google-map under Shadow dom as they are under Shady dom. The code uses a MutationObserver to look for changes, but the content is inside an iron-selector:
That makes content#markers light dom to the iron-selector, but shadow/shady dom to google-map. Mutation events do not bubble to the outside from within shadow dom. There is even a test for this in the Chromium project - LayoutTests/fast/dom/MutationObserver/shadow-dom.html.
In any case, iron-selector is already observing changes to content#markers. In this PR the google-map is modified to listen for changes to the items property of iron-selector#selector instead of using a MutationObserver.
The existing test, markers-add-remove.html, illustrates both the issue and this fix. With the fix we can add the dom=shadow variety of this test to the list of suites to run.