MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / parseArg

Function parseArg

src/ext/component.js:76–90  ·  view source on GitHub ↗
(componentEl, prop)

Source from the content-addressed store, hash-verified

74 }
75
76 function parseArg(componentEl, prop) {
77 if (typeof prop !== 'string') return null;
78 var cache = componentEl._attrsCache || (componentEl._attrsCache = {});
79 if (!cache[prop]) {
80 var attrValue = componentEl.getAttribute(prop);
81 if (attrValue == null) return null;
82 try {
83 cache[prop] = createParser(tokenizer.tokenize(attrValue)).requireElement("expression");
84 } catch (e) {
85 console.error("component: failed to parse attrs." + prop + ":", e.message);
86 return null;
87 }
88 }
89 return cache[prop];
90 }
91
92 function parentContext(componentEl) {
93 var parent = componentEl.parentElement;

Callers 1

createAttrsFunction · 0.70

Calls 2

requireElementMethod · 0.45
tokenizeMethod · 0.45

Tested by

no test coverage detected