MCPcopy Create free account
hub / github.com/UI5/webcomponents / formatAttrs

Function formatAttrs

packages/main/test/pages/diffable-html.js:2284–2305  ·  view source on GitHub ↗
(attributes, opts)

Source from the content-addressed store, hash-verified

2282 Format attributes
2283 */
2284 function formatAttrs(attributes, opts) {
2285 if (!attributes) return;
2286
2287 var output = '',
2288 value;
2289
2290 // Loop through the attributes
2291 for (var key in attributes) {
2292 value = attributes[key];
2293 if (output) {
2294 output += ' ';
2295 }
2296
2297 if (!value && booleanAttributes[key]) {
2298 output += key;
2299 } else {
2300 output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"';
2301 }
2302 }
2303
2304 return output;
2305 }
2306
2307 /*
2308 Self-enclosing tags (stolen from node-htmlparser)

Callers 1

renderTagFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…