MCPcopy
hub / github.com/amark/gun / tag

Function tag

test/mocha.js:3888–3904  ·  view source on GitHub ↗

* HTML tag helper. * * @param name * @param attrs * @param close * @param content * @return {string}

(name, attrs, close, content)

Source from the content-addressed store, hash-verified

3886 * @return {string}
3887 */
3888function tag(name, attrs, close, content) {
3889 var end = close ? '/>' : '>';
3890 var pairs = [];
3891 var tag;
3892
3893 for (var key in attrs) {
3894 if (Object.prototype.hasOwnProperty.call(attrs, key)) {
3895 pairs.push(key + '="' + escape(attrs[key]) + '"');
3896 }
3897 }
3898
3899 tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
3900 if (content) {
3901 tag += content + '</' + name + end;
3902 }
3903 return tag;
3904}
3905
3906/**
3907 * Return cdata escaped CDATA `str`.

Callers 2

XUnitFunction · 0.85
mocha.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected