Skip to content

Commit f5ce7ad

Browse files
authored
fix(debugger): exclude internal props from devtools elements (#11344)
[skip ci]
1 parent d13a594 commit f5ce7ad

2 files changed

Lines changed: 43 additions & 12 deletions

File tree

packages/core/debugger/dom-types.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,37 @@ import { PercentLength } from '../ui/styling/length-shared';
55
import { getSetProperties, getComputedCssValues } from '../ui/core/properties';
66
const ELEMENT_NODE_TYPE = 1;
77
const ROOT_NODE_TYPE = 9;
8-
const propertyBlacklist = ['effectivePaddingLeft', 'effectivePaddingBottom', 'effectivePaddingRight', 'effectivePaddingTop', 'effectiveBorderTopWidth', 'effectiveBorderRightWidth', 'effectiveBorderBottomWidth', 'effectiveBorderLeftWidth', 'effectiveMinWidth', 'effectiveMinHeight', 'effectiveWidth', 'effectiveHeight', 'effectiveMarginLeft', 'effectiveMarginTop', 'effectiveMarginRight', 'effectiveMarginBottom', 'effectiveRowGap', 'effectiveColumnGap', 'nodeName', 'nodeType', 'decodeWidth', 'decodeHeight', 'ng-reflect-items', 'domNode', 'touchListenerIsSet', 'bindingContext', 'nativeView'];
8+
const propertyBlacklist = [
9+
'effectivePaddingLeft',
10+
'effectivePaddingBottom',
11+
'effectivePaddingRight',
12+
'effectivePaddingTop',
13+
'effectiveBorderTopWidth',
14+
'effectiveBorderRightWidth',
15+
'effectiveBorderBottomWidth',
16+
'effectiveBorderLeftWidth',
17+
'effectiveMinWidth',
18+
'effectiveMinHeight',
19+
'effectiveMaxWidth',
20+
'effectiveMaxHeight',
21+
'effectiveWidth',
22+
'effectiveHeight',
23+
'effectiveMarginLeft',
24+
'effectiveMarginTop',
25+
'effectiveMarginRight',
26+
'effectiveMarginBottom',
27+
'effectiveRowGap',
28+
'effectiveColumnGap',
29+
'nodeName',
30+
'nodeType',
31+
'decodeWidth',
32+
'decodeHeight',
33+
'ng-reflect-items',
34+
'domNode',
35+
'touchListenerIsSet',
36+
'bindingContext',
37+
'nativeView',
38+
];
939

1040
function lazy<T>(action: () => T): () => T {
1141
let _value: T;

packages/core/ui/core/view-base/index.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,14 @@ export abstract class ViewBase extends Observable {
337337
private _style: Style;
338338
private _isLoaded: boolean;
339339

340+
/**
341+
* if _setupAsRootView is called it means it is not supposed to be
342+
* added to a parent. However parent can be set before for the purpose
343+
* of CSS variables/classes. That variable ensures that _addViewToNativeVisualTree
344+
* is not called in _setupAsRootView
345+
*/
346+
private _isRootView = false;
347+
340348
private _effectivePaddingTop: number = null;
341349
private _effectivePaddingRight: number = null;
342350
private _effectivePaddingBottom: number = null;
@@ -1147,17 +1155,10 @@ export abstract class ViewBase extends Observable {
11471155
// }
11481156
}
11491157

1150-
/**
1151-
* if _setupAsRootView is called it means it is not supposed to be
1152-
* added to a parent. However parent can be set before for the purpose
1153-
* of CSS variables/classes. That variable ensures that _addViewToNativeVisualTree
1154-
* is not called in _setupAsRootView
1155-
*/
1156-
mIsRootView = false;
11571158
_setupAsRootView(context: any): void {
1158-
this.mIsRootView = true;
1159+
this._isRootView = true;
11591160
this._setupUI(context);
1160-
this.mIsRootView = false;
1161+
this._isRootView = false;
11611162
}
11621163

11631164
/**
@@ -1170,7 +1171,7 @@ export abstract class ViewBase extends Observable {
11701171
// this check is unnecessary as this function should never be called when this._context === context as it means the view was somehow detached,
11711172
// which is only possible by setting reusable = true. Adding it either way for feature flag safety
11721173
if (this.reusable) {
1173-
if (!this.mIsRootView && this.parent && !this._isAddedToNativeVisualTree) {
1174+
if (!this._isRootView && this.parent && !this._isAddedToNativeVisualTree) {
11741175
const nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex);
11751176
this._isAddedToNativeVisualTree = this.parent._addViewToNativeVisualTree(this, nativeIndex);
11761177
}
@@ -1228,7 +1229,7 @@ export abstract class ViewBase extends Observable {
12281229

12291230
this.setNativeView(nativeView);
12301231

1231-
if (!this.mIsRootView && this.parent) {
1232+
if (!this._isRootView && this.parent) {
12321233
const nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex);
12331234
this._isAddedToNativeVisualTree = this.parent._addViewToNativeVisualTree(this, nativeIndex);
12341235
}

0 commit comments

Comments
 (0)