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

Function genCheckboxModel

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

Source from the content-addressed store, hash-verified

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

Callers 1

modelFunction · 0.70

Calls 3

getBindingAttrFunction · 0.70
addPropFunction · 0.70
addHandlerFunction · 0.70

Tested by

no test coverage detected