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

Function _createExpressionSide

tools/common/_hyperscript.iife.js:9543–9568  ·  view source on GitHub ↗
(expr, target, feature, runtime2)

Source from the content-addressed store, hash-verified

9541 };
9542 }
9543 function _createExpressionSide(expr, target, feature, runtime2) {
9544 if (expr.type === "classRef") {
9545 return {
9546 read: function() {
9547 runtime2.resolveAttribute(target, "class");
9548 return target.classList.contains(expr.className);
9549 },
9550 write: function(value) {
9551 if (value) {
9552 target.classList.add(expr.className);
9553 } else {
9554 target.classList.remove(expr.className);
9555 }
9556 }
9557 };
9558 }
9559 return {
9560 read: function() {
9561 return expr.evaluate(runtime2.makeContext(target, feature, target, null));
9562 },
9563 write: function(value) {
9564 var ctx = runtime2.makeContext(target, feature, target, null);
9565 _assignTo(runtime2, expr, ctx, value);
9566 }
9567 };
9568 }
9569 function _setupFormReset(leftSide, rightSide, target, runtime2) {
9570 _addResetListener(leftSide, rightSide, target, runtime2);
9571 _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