Skip to content

Instantly share code, notes, and snippets.

<!--
// https://stackoverflow.com/questions/78105670/cutom-elements-cant-extend-from-button-illegal-constructor/78106993
//-->
<script>
(function (globalThis) {
// scope of `dom-safari` or `custom-element-safari` module
'use strict';
const defaultDescriptorOptions = { enumerable: false, writable: true, configurable: true };
const sealedDescriptorOptions = { enumerable: false, configurable: false };
/**
* Returns the internal `[[Class]]` tag of a value, like `[object String]` or returns `undefined`
* if no argument was passed.
*
* @param {...any} args
* A variadic argument list. The first argument (`args[0]`) is the optional `value` parameter.
* Its **presence** is detected via `args.length`, allowing the function to distinguish between
Symbol.fnDirectives = Symbol.for('fnDirectives');
// const directivesSymbol = Symbol.fnDirectives;
// console.log(Symbol.for(Symbol.keyFor(directivesSymbol)) === Symbol.fnDirectives); // true
const functionPrototype = Function.prototype;
const toFunctionString = functionPrototype.toString;
function parseBodyFromFctString(fctString) {
const [ head ] = fctString
/**
* Module: function.bind.with-exotic-object-slots
*
* TypeScript declaration for a custom override of `Function.prototype.bind`
* that stores ECMAScript-like internal slot metadata as Symbol-based properties
* on bound functions.
*
* Inspired by ECMAScript internal slots:
* - `[[BoundTargetFunction]]`
* - `[[BoundThis]]`
/**
* This callback is the custom provided executor-function
* which gets all of an abortable promise's specific resolver
* functions and its abort signal passed into.
* This callback defines how the created promise does settle.
*
* @callback abortablePromiseExecutor
* @param {(value?: any) => void} resolve
* Does resolve its promise with a result.
* @param {(reason?: any) => void} reject
function getTypeSignature(...args) {
const [value] = args;
return ((args.length > 0) && Object.prototype.toString.call(value).trim()) || value;
}
function getTaggedType(...args) {
return getTypeSignature(...args)?.slice(8, -1);
}
function getDefinedConstructor(value = null) {
return (value !== null)