14 lines
320 B
JavaScript
14 lines
320 B
JavaScript
|
/**
|
||
|
* Escapes characters that can not be in an XML attribute.
|
||
|
*/
|
||
|
function escapeAttribute(value) {
|
||
|
return value.replace(/&/g, '&').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @api private
|
||
|
*/
|
||
|
module.exports = {
|
||
|
escapeAttribute: escapeAttribute
|
||
|
};
|