(element: Element | null, properties: {[name: string]: string})
| 390 | } |
| 391 | |
| 392 | function 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 | |
| 415 | function isPrimitiveValue(value: any): boolean { |
| 416 | return ( |
no test coverage detected
searching dependent graphs…