import { type RefObject } from 'preact'; import { directive, isNonDefaultDirectiveSuffix } from '../hooks'; import { isBindingAllowed } from './utils/restricted-bindings'; import { useInit, isReservedKey, warn } from '../utils'; import { PENDING_GETTER } from '../proxies/state'; import { warnEventHandlerBindNotSupported, warnUniqueIdNotSupported, warnUnbindableProp, } from './utils/warnings'; import { getSafeUrl, urlAttributes } from './utils/url'; // Lowercase names of internal properties that are not binding candidates. const internalProps = new Set( [ '__directives', 'children', 'dangerouslysetinnerhtml', ] ); // data-wp-bind--[attribute] binding. directive( 'bind', ( { directives: { bind }, element, evaluate } ) => { bind.filter( isNonDefaultDirectiveSuffix ).forEach( ( entry ) => { if ( entry.uniqueId ) { if ( globalThis.SCRIPT_DEBUG ) { warnUniqueIdNotSupported( 'bind', entry.uniqueId ); } return; } const attribute = entry.suffix; const name = attribute.toLowerCase(); if ( internalProps.has( name ) || // `toVdom()` stores a `