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

Function setAttr

static/vuejs/vue.runtime.common.js:5277–5301  ·  view source on GitHub ↗
(el, key, value)

Source from the content-addressed store, hash-verified

5275}
5276
5277function setAttr (el, key, value) {
5278 if (isBooleanAttr(key)) {
5279 // set attribute for blank value
5280 // e.g. <option disabled>Select one</option>
5281 if (isFalsyAttrValue(value)) {
5282 el.removeAttribute(key);
5283 } else {
5284 el.setAttribute(key, key);
5285 }
5286 } else if (isEnumeratedAttr(key)) {
5287 el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
5288 } else if (isXlink(key)) {
5289 if (isFalsyAttrValue(value)) {
5290 el.removeAttributeNS(xlinkNS, getXlinkProp(key));
5291 } else {
5292 el.setAttributeNS(xlinkNS, key, value);
5293 }
5294 } else {
5295 if (isFalsyAttrValue(value)) {
5296 el.removeAttribute(key);
5297 } else {
5298 el.setAttribute(key, value);
5299 }
5300 }
5301}
5302
5303var attrs = {
5304 create: updateAttrs,

Callers 1

updateAttrsFunction · 0.70

Calls 4

isFalsyAttrValueFunction · 0.70
isXlinkFunction · 0.70
getXlinkPropFunction · 0.70
setAttributeMethod · 0.45

Tested by

no test coverage detected