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

Method resolve

www/js/_hyperscript-max.js:4317–4347  ·  view source on GitHub ↗
(context, { root: rootVal, target })

Source from the content-addressed store, hash-verified

4315 return parser.parseElement("indirectExpression", result);
4316 }
4317 resolve(context, { root: rootVal, target }) {
4318 if (rootVal == null) return [];
4319 var returnArr = [];
4320 if (rootVal.css) {
4321 context.meta.runtime.implicitLoop(target, function(targetElt) {
4322 var results = context.meta.runtime.resolveQuery(targetElt, rootVal.css);
4323 for (var i = 0; i < results.length; i++) {
4324 returnArr.push(results[i]);
4325 }
4326 });
4327 } else if (rootVal instanceof Element) {
4328 var within = false;
4329 context.meta.runtime.implicitLoop(target, function(targetElt) {
4330 if (targetElt.contains(rootVal)) {
4331 within = true;
4332 }
4333 });
4334 if (within) {
4335 return rootVal;
4336 }
4337 } else {
4338 context.meta.runtime.implicitLoop(rootVal, function(rootElt) {
4339 context.meta.runtime.implicitLoop(target, function(targetElt) {
4340 if (rootElt === targetElt) {
4341 returnArr.push(rootElt);
4342 }
4343 });
4344 });
4345 }
4346 return returnArr;
4347 }
4348 get lhs() {
4349 return { root: this.root, target: this.target };
4350 }

Callers 1

setMethod · 0.95

Calls 3

implicitLoopMethod · 0.45
resolveQueryMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected