Improve filtering of HTML entities from translated strings used in js, see #8254
git-svn-id: https://develop.svn.wordpress.org/trunk@9836 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8969d49dbe
commit
02be72d69a
|
@ -30,17 +30,21 @@ wp_admin_css( 'css/ie' );
|
||||||
addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
|
addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
|
||||||
|
|
||||||
function convertEntities(o) {
|
function convertEntities(o) {
|
||||||
var p = document.createElement('p');
|
var c = function(s) {
|
||||||
var c = function(s) { p.innerHTML = s; return p.innerHTML; }
|
if (/&[^;]+;/.test(s)) {
|
||||||
|
var e = document.createElement("div");
|
||||||
|
e.innerHTML = s;
|
||||||
|
return !e.firstChild ? s : e.firstChild.nodeValue;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
if ( typeof o === 'object' )
|
if ( typeof o === 'object' ) {
|
||||||
for (var v in o)
|
for (var v in o)
|
||||||
o[v] = c(o[v]);
|
o[v] = c(o[v]);
|
||||||
|
return o;
|
||||||
else if ( typeof o === 'string' )
|
} else if ( typeof o === 'string' )
|
||||||
return c(o);
|
return c(o);
|
||||||
|
|
||||||
p = null;
|
|
||||||
};
|
};
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue