mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-11 11:25:47 +01:00
Death to E4X and stuff.
This commit is contained in:
@@ -1501,11 +1501,14 @@ var DOM = Class("DOM", {
|
||||
* entities.
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {boolean} simple If true, only escape for the simple case
|
||||
* of text nodes.
|
||||
* @returns {string}
|
||||
*/
|
||||
escapeHTML: function escapeHTML(str) {
|
||||
escapeHTML: function escapeHTML(str, simple) {
|
||||
let map = { "'": "'", '"': """, "%": "%", "&": "&", "<": "<", ">": ">" };
|
||||
return str.replace(/['"&<>]/g, function (m) map[m]);
|
||||
let regexp = simple ? /[<>]/g : /['"&<>]/g;
|
||||
return str.replace(regexp, function (m) map[m]);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user