MCPcopy Index your code
hub / github.com/ampproject/amphtml / copyProperties

Function copyProperties

src/polyfills/custom-elements.js:849–869  ·  view source on GitHub ↗
(obj, prototype)

Source from the content-addressed store, hash-verified

847 * @visibleForTesting
848 */
849export function copyProperties(obj, prototype) {
850 let current = prototype;
851 while (current !== null) {
852 if (Object.isPrototypeOf.call(current, obj)) {
853 break;
854 }
855
856 for (const prop of Object.getOwnPropertyNames(current)) {
857 if (Object.hasOwnProperty.call(obj, prop)) {
858 continue;
859 }
860
861 const desc = /** @type {!ObjectPropertyDescriptor<Object>} */ (
862 Object.getOwnPropertyDescriptor(current, prop)
863 );
864 Object.defineProperty(obj, prop, desc);
865 }
866
867 current = Object.getPrototypeOf(current);
868 }
869}
870
871/**
872 * Polyfills Custom Elements v1 API. This has 5 modes:

Callers 2

setPrototypeOfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected