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

Function _createExpressionSide

www/js/_hyperscript-max.js:9996–10021  ·  view source on GitHub ↗
(expr, target, feature, runtime2)

Source from the content-addressed store, hash-verified

9994 };
9995 }
9996 function _createExpressionSide(expr, target, feature, runtime2) {
9997 if (expr.type === "classRef") {
9998 return {
9999 read: function() {
10000 runtime2.resolveAttribute(target, "class");
10001 return target.classList.contains(expr.className);
10002 },
10003 write: function(value) {
10004 if (value) {
10005 target.classList.add(expr.className);
10006 } else {
10007 target.classList.remove(expr.className);
10008 }
10009 }
10010 };
10011 }
10012 return {
10013 read: function() {
10014 return expr.evaluate(runtime2.makeContext(target, feature, target, null));
10015 },
10016 write: function(value) {
10017 var ctx = runtime2.makeContext(target, feature, target, null);
10018 _assignTo(runtime2, expr, ctx, value);
10019 }
10020 };
10021 }
10022 function _setupFormReset(leftSide, rightSide, target, runtime2) {
10023 _addResetListener(leftSide, rightSide, target, runtime2);
10024 _addResetListener(rightSide, leftSide, target, runtime2);

Callers 1

_resolveSideFunction · 0.70

Calls 5

_assignToFunction · 0.70
resolveAttributeMethod · 0.45
containsMethod · 0.45
evaluateMethod · 0.45
makeContextMethod · 0.45

Tested by

no test coverage detected