MCPcopy
hub / github.com/Mottie/Keyboard / escapeText

Function escapeText

testing/qunit-2.9.2.js:4561–4582  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

4559
4560 // Escape text for attribute or text content.
4561 function escapeText(s) {
4562 if (!s) {
4563 return "";
4564 }
4565 s = s + "";
4566
4567 // Both single quotes and double quotes (for attributes)
4568 return s.replace(/['"<>&]/g, function (s) {
4569 switch (s) {
4570 case "'":
4571 return "&#039;";
4572 case "\"":
4573 return "&quot;";
4574 case "<":
4575 return "&lt;";
4576 case ">":
4577 return "&gt;";
4578 case "&":
4579 return "&amp;";
4580 }
4581 });
4582 }
4583
4584 (function () {
4585

Callers 7

getUrlConfigHtmlFunction · 0.85
moduleListHtmlFunction · 0.85
appendHeaderFunction · 0.85
appendFilteredTestFunction · 0.85
appendInterfaceFunction · 0.85
getNameHtmlFunction · 0.85
qunit-2.9.2.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected