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

Function parseArg

www/js/_hyperscript-max.js:11074–11088  ·  view source on GitHub ↗
(componentEl, prop)

Source from the content-addressed store, hash-verified

11072 return source;
11073 }
11074 function parseArg(componentEl, prop) {
11075 if (typeof prop !== "string") return null;
11076 var cache = componentEl._attrsCache || (componentEl._attrsCache = {});
11077 if (!cache[prop]) {
11078 var attrValue = componentEl.getAttribute(prop);
11079 if (attrValue == null) return null;
11080 try {
11081 cache[prop] = createParser(tokenizer2.tokenize(attrValue)).requireElement("expression");
11082 } catch (e) {
11083 console.error("component: failed to parse attrs." + prop + ":", e.message);
11084 return null;
11085 }
11086 }
11087 return cache[prop];
11088 }
11089 function parentContext(componentEl) {
11090 var parent = componentEl.parentElement;
11091 return parent ? runtime2.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