MCPcopy Create free account
hub / github.com/Nynxz/ComfyUI-IdeogramHelper / patchProp

Function patchProp

web/main.js:7281–7311  ·  view source on GitHub ↗
(el, key, prevValue, nextValue, namespace, parentComponent)

Source from the content-addressed store, hash-verified

7279const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
7280key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
7281const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
7282 const isSVG = namespace === "svg";
7283 if (key === "class") {
7284 patchClass(el, nextValue, isSVG);
7285 } else if (key === "style") {
7286 patchStyle(el, prevValue, nextValue);
7287 } else if (isOn(key)) {
7288 if (!isModelListener(key)) {
7289 patchEvent(el, key, prevValue, nextValue, parentComponent);
7290 }
7291 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
7292 patchDOMProp(el, key, nextValue);
7293 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
7294 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
7295 }
7296 } else if (
7297 // #11081 force set props for possible async custom element
7298 el._isVueCE && // #12408 check if it's declared prop or it's async custom element
7299 (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
7300 el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
7301 ) {
7302 patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
7303 } else {
7304 if (key === "true-value") {
7305 el._trueValue = nextValue;
7306 } else if (key === "false-value") {
7307 el._falseValue = nextValue;
7308 }
7309 patchAttr(el, key, nextValue, isSVG);
7310 }
7311};
7312function shouldSetAsProp(el, key, value, isSVG) {
7313 if (isSVG) {
7314 if (key === "innerHTML" || key === "textContent") {

Callers

nothing calls this directly

Calls 10

patchClassFunction · 0.85
patchStyleFunction · 0.85
isOnFunction · 0.85
isModelListenerFunction · 0.85
patchEventFunction · 0.85
shouldSetAsPropFunction · 0.85
patchDOMPropFunction · 0.85
patchAttrFunction · 0.85
shouldSetAsPropForVueCEFunction · 0.85
isStringFunction · 0.85

Tested by

no test coverage detected