mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Sandbox: Set the style
attribute of all Element
child to be a live target (#72208)
This commit is contained in:
parent
a227dcdfcb
commit
20d7cf34b2
@ -79,13 +79,9 @@ export function isDomElement(obj: unknown): obj is Element {
|
|||||||
* This is necessary for plugins working with style attributes to work in Chrome
|
* This is necessary for plugins working with style attributes to work in Chrome
|
||||||
*/
|
*/
|
||||||
export function markDomElementStyleAsALiveTarget(el: Element) {
|
export function markDomElementStyleAsALiveTarget(el: Element) {
|
||||||
if (
|
const style = Reflect.get(el, 'style');
|
||||||
// only HTMLElement's (extends Element) have a style attribute
|
if (!Object.hasOwn(style, SANDBOX_LIVE_VALUE)) {
|
||||||
el instanceof HTMLElement &&
|
Reflect.defineProperty(style, SANDBOX_LIVE_VALUE, {});
|
||||||
// do not define it twice
|
|
||||||
!Object.hasOwn(el.style, SANDBOX_LIVE_VALUE)
|
|
||||||
) {
|
|
||||||
Reflect.defineProperty(el.style, SANDBOX_LIVE_VALUE, {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user