MCPcopy Create free account
hub / github.com/Yaffle/EventSource / escapeText

Function escapeText

tests/qunit.js:977–997  ·  view source on GitHub ↗

* Escape text for attribute or text content.

( s )

Source from the content-addressed store, hash-verified

975 * Escape text for attribute or text content.
976 */
977function escapeText( s ) {
978 if ( !s ) {
979 return "";
980 }
981 s = s + "";
982 // Both single quotes and double quotes (for attributes)
983 return s.replace( /['"<>&]/g, function( s ) {
984 switch( s ) {
985 case "'":
986 return "&#039;";
987 case "\"":
988 return "&quot;";
989 case "<":
990 return "&lt;";
991 case ">":
992 return "&gt;";
993 case "&":
994 return "&amp;";
995 }
996 });
997}
998
999function synchronize( callback, last ) {
1000 config.queue.push( callback );

Callers 1

qunit.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected