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

Function setAttr

static/vuejs/vue.runtime.esm.js:5275–5299  ·  view source on GitHub ↗
(el, key, value)

Source from the content-addressed store, hash-verified

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