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

Function setAttr

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

Source from the content-addressed store, hash-verified

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