/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. * v1.0.0-beta.82 */ import { createObserver } from "./observers"; const allowedGlobalAttributes = ["lang"]; const elementToComponentAndObserverOptionsMap = new Map(); let mutationObserver; function updateGlobalAttributes(component, attributeFilter) { const { el } = component; const updatedAttributes = {}; attributeFilter .filter((attr) => !!allowedGlobalAttributes.includes(attr) && !!el.hasAttribute(attr)) .forEach((attr) => { const value = el.getAttribute(attr); if (value !== null) { updatedAttributes[attr] = value; } }); component.globalAttributes = updatedAttributes; } function processMutations(mutations) { mutations.forEach(({ target }) => { const [component, options] = elementToComponentAndObserverOptionsMap.get(target); updateGlobalAttributes(component, options.attributeFilter); }); } /** * Helper to set up listening for changes to global attributes. * * render(): VNode { * const lang = this.inheritedAttributes['lang'] ?? 'en'; * return