MCPcopy Create free account
hub / github.com/TruthHun/BookStack / genCheckboxModel

Function genCheckboxModel

static/vuejs/vue.common.js:5746–5775  ·  view source on GitHub ↗
(
  el,
  value,
  modifiers
)

Source from the content-addressed store, hash-verified

5744}
5745
5746function genCheckboxModel (
5747 el,
5748 value,
5749 modifiers
5750) {
5751 var number = modifiers && modifiers.number;
5752 var valueBinding = getBindingAttr(el, 'value') || 'null';
5753 var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
5754 var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
5755 addProp(el, 'checked',
5756 "Array.isArray(" + value + ")" +
5757 "?_i(" + value + "," + valueBinding + ")>-1" + (
5758 trueValueBinding === 'true'
5759 ? (":(" + value + ")")
5760 : (":_q(" + value + "," + trueValueBinding + ")")
5761 )
5762 );
5763 addHandler(el, CHECKBOX_RADIO_TOKEN,
5764 "var $$a=" + value + "," +
5765 '$$el=$event.target,' +
5766 "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
5767 'if(Array.isArray($$a)){' +
5768 "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
5769 '$$i=_i($$a,$$v);' +
5770 "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
5771 "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
5772 "}else{" + value + "=$$c}",
5773 null, true
5774 );
5775}
5776
5777function genRadioModel (
5778 el,

Callers 1

modelFunction · 0.70

Calls 3

getBindingAttrFunction · 0.70
addPropFunction · 0.70
addHandlerFunction · 0.70

Tested by

no test coverage detected