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

Function model

static/vuejs/vue.common.js:5692–5744  ·  view source on GitHub ↗
(
  el,
  dir,
  _warn
)

Source from the content-addressed store, hash-verified

5690var CHECKBOX_RADIO_TOKEN = '__c';
5691
5692function model (
5693 el,
5694 dir,
5695 _warn
5696) {
5697 warn$1 = _warn;
5698 var value = dir.value;
5699 var modifiers = dir.modifiers;
5700 var tag = el.tag;
5701 var type = el.attrsMap.type;
5702
5703 if (process.env.NODE_ENV !== 'production') {
5704 var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
5705 if (tag === 'input' && dynamicType) {
5706 warn$1(
5707 "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
5708 "v-model does not support dynamic input types. Use v-if branches instead."
5709 );
5710 }
5711 // inputs with type="file" are read only and setting the input's
5712 // value will throw an error.
5713 if (tag === 'input' && type === 'file') {
5714 warn$1(
5715 "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
5716 "File inputs are read only. Use a v-on:change listener instead."
5717 );
5718 }
5719 }
5720
5721 if (tag === 'select') {
5722 genSelect(el, value, modifiers);
5723 } else if (tag === 'input' && type === 'checkbox') {
5724 genCheckboxModel(el, value, modifiers);
5725 } else if (tag === 'input' && type === 'radio') {
5726 genRadioModel(el, value, modifiers);
5727 } else if (tag === 'input' || tag === 'textarea') {
5728 genDefaultModel(el, value, modifiers);
5729 } else if (!config.isReservedTag(tag)) {
5730 genComponentModel(el, value, modifiers);
5731 // component v-model doesn't need extra runtime
5732 return false
5733 } else if (process.env.NODE_ENV !== 'production') {
5734 warn$1(
5735 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
5736 "v-model is not supported on this element type. " +
5737 'If you are working with contenteditable, it\'s recommended to ' +
5738 'wrap a library dedicated for that purpose inside a custom component.'
5739 );
5740 }
5741
5742 // ensure runtime directive metadata
5743 return true
5744}
5745
5746function genCheckboxModel (
5747 el,

Callers

nothing calls this directly

Calls 5

genSelectFunction · 0.70
genCheckboxModelFunction · 0.70
genRadioModelFunction · 0.70
genDefaultModelFunction · 0.70
genComponentModelFunction · 0.70

Tested by

no test coverage detected