Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/content/snippets.js

Issue 29837563: Issue 6803 - Rename local observe function to observeShadow (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created July 24, 2018, 4:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/content/snippets.js
===================================================================
--- a/lib/content/snippets.js
+++ b/lib/content/snippets.js
@@ -198,17 +198,17 @@
// be Firefox or an older version of Chrome.
if (!originalAttachShadow)
return;
// Mutation observers mapped to their corresponding shadow roots and their
// hosts.
let shadows = new WeakMap();
- function observe(mutations, observer)
+ function observeShadow(mutations, observer)
{
let {host, root} = shadows.get(observer) || {};
// Since it's a weak map, it's possible that either the element or its
// shadow has been removed.
if (!host || !root)
return;
@@ -234,17 +234,17 @@
Object.defineProperty(Element.prototype, "attachShadow", {
value(...args)
{
// Create the shadow root first. It doesn't matter if it's a closed
// shadow root, we keep the reference in a weak map.
let root = originalAttachShadow.apply(this, args);
// Listen for relevant DOM mutations in the shadow.
- let observer = new MutationObserver(observe);
+ let observer = new MutationObserver(observeShadow);
observer.observe(root, {
childList: true,
characterData: true,
subtree: true
});
// Keep references to the shadow root and its host in a weak map. If
// either the shadow is detached or the host itself is removed from the
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld