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

Function setAttr

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

Source from the content-addressed store, hash-verified

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