This patch changes the Ivy `DebugElement` code to always read style and class values directly from the native element instead of reading them through the styling contexts. The reason for this change is because Ivy does not make use of a debug renderer and will therefore not have access to any classes/styles applied directly through the renderer (unless it reads the values directly from the element). PR Close #32842
31 lines
859 B
TypeScript
31 lines
859 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
import {global} from '../util/global';
|
|
|
|
/**
|
|
* Used to inform TS about the `Proxy` class existing globally.
|
|
*/
|
|
interface GlobalWithProxy {
|
|
Proxy: typeof Proxy;
|
|
}
|
|
|
|
/**
|
|
* Creates an instance of a `Proxy` and creates with an empty target object and binds it to the
|
|
* provided handler.
|
|
*
|
|
* The reason why this function exists is because IE doesn't support
|
|
* the `Proxy` class. For this reason an error must be thrown.
|
|
*/
|
|
export function createProxy(handler: ProxyHandler<any>): {} {
|
|
const g = global as any as GlobalWithProxy;
|
|
if (!g.Proxy) {
|
|
throw new Error('Proxy is not supported in this browser');
|
|
}
|
|
return new g.Proxy({}, handler);
|
|
}
|