MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / parseArg

Function parseArg

www/js/ext/component.js:663–677  ·  view source on GitHub ↗
(componentEl, prop)

Source from the content-addressed store, hash-verified

661 return source;
662 }
663 function parseArg(componentEl, prop) {
664 if (typeof prop !== "string") return null;
665 var cache = componentEl._attrsCache || (componentEl._attrsCache = {});
666 if (!cache[prop]) {
667 var attrValue = componentEl.getAttribute(prop);
668 if (attrValue == null) return null;
669 try {
670 cache[prop] = createParser(tokenizer.tokenize(attrValue)).requireElement("expression");
671 } catch (e) {
672 console.error("component: failed to parse attrs." + prop + ":", e.message);
673 return null;
674 }
675 }
676 return cache[prop];
677 }
678 function parentContext(componentEl) {
679 var parent = componentEl.parentElement;
680 return parent ? runtime.makeContext(parent, null, parent, null) : null;

Callers 1

createAttrsFunction · 0.70

Calls 2

requireElementMethod · 0.45
tokenizeMethod · 0.45

Tested by

no test coverage detected