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

Method resolve

tools/common/_hyperscript.iife.js:4009–4039  ·  view source on GitHub ↗
(context, { root: rootVal, target })

Source from the content-addressed store, hash-verified

4007 return parser.parseElement("indirectExpression", inExpression);
4008 }
4009 resolve(context, { root: rootVal, target }) {
4010 if (rootVal == null) return [];
4011 var returnArr = [];
4012 if (rootVal.css) {
4013 context.meta.runtime.implicitLoop(target, function(targetElt) {
4014 var results = targetElt.querySelectorAll(rootVal.css);
4015 for (var i = 0; i < results.length; i++) {
4016 returnArr.push(results[i]);
4017 }
4018 });
4019 } else if (rootVal instanceof Element) {
4020 var within = false;
4021 context.meta.runtime.implicitLoop(target, function(targetElt) {
4022 if (targetElt.contains(rootVal)) {
4023 within = true;
4024 }
4025 });
4026 if (within) {
4027 return rootVal;
4028 }
4029 } else {
4030 context.meta.runtime.implicitLoop(rootVal, function(rootElt) {
4031 context.meta.runtime.implicitLoop(target, function(targetElt) {
4032 if (rootElt === targetElt) {
4033 returnArr.push(rootElt);
4034 }
4035 });
4036 });
4037 }
4038 return returnArr;
4039 }
4040 get lhs() {
4041 return { root: this.root, target: this.target };
4042 }

Callers 1

setMethod · 0.95

Calls 2

implicitLoopMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected