mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-18 22:05:46 +01:00
merge faster replace() based v.util.escapeHTML
This commit is contained in:
@@ -29,9 +29,13 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
vimperator.util = {
|
vimperator.util = {
|
||||||
escapeHTML: function(str)
|
escapeHTML: function(str)
|
||||||
{
|
{
|
||||||
var e = window.content.document.createElement("div");
|
// XXX: the following code is _much_ slower than a simple .replace()
|
||||||
e.appendChild(window.content.document.createTextNode(str));
|
// :history display went down from 2 to 1 second after changing
|
||||||
return e.innerHTML;
|
//
|
||||||
|
// var e = window.content.document.createElement("div");
|
||||||
|
// e.appendChild(window.content.document.createTextNode(str));
|
||||||
|
// return e.innerHTML;
|
||||||
|
return str.replace("&", "&", "g").replace("<", "<", "g").replace(">", ">", "g");
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: use :highlight color groups
|
// TODO: use :highlight color groups
|
||||||
|
|||||||
Reference in New Issue
Block a user