MCPcopy
hub / github.com/angular/angular / copyDomProperties

Function copyDomProperties

packages/core/src/debug/debug_node.ts:392–413  ·  view source on GitHub ↗
(element: Element | null, properties: {[name: string]: string})

Source from the content-addressed store, hash-verified

390}
391
392function copyDomProperties(element: Element | null, properties: {[name: string]: string}): void {
393 if (element) {
394 // Skip own properties (as those are patched)
395 let obj = Object.getPrototypeOf(element);
396 const NodePrototype: any = Node.prototype;
397 while (obj !== null && obj !== NodePrototype) {
398 const descriptors = Object.getOwnPropertyDescriptors(obj);
399 for (let key in descriptors) {
400 if (!key.startsWith('__') && !key.startsWith('on')) {
401 // don't include properties starting with `__` and `on`.
402 // `__` are patched values which should not be included.
403 // `on` are listeners which also should not be included.
404 const value = (element as any)[key];
405 if (isPrimitiveValue(value)) {
406 properties[key] = value;
407 }
408 }
409 }
410 obj = Object.getPrototypeOf(obj);
411 }
412 }
413}
414
415function isPrimitiveValue(value: any): boolean {
416 return (

Callers 1

propertiesMethod · 0.85

Calls 1

isPrimitiveValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…