mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
Improve filtering of HTML entities from translated strings used in js, see #8254
git-svn-id: http://svn.automattic.com/wordpress/trunk@9836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
61fb6ea540
commit
a10c8691fd
@ -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();}}};
|
||||
|
||||
function convertEntities(o) {
|
||||
var p = document.createElement('p');
|
||||
var c = function(s) { p.innerHTML = s; return p.innerHTML; }
|
||||
var c = function(s) {
|
||||
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)
|
||||
o[v] = c(o[v]);
|
||||
|
||||
else if ( typeof o === 'string' )
|
||||
return o;
|
||||
} else if ( typeof o === 'string' )
|
||||
return c(o);
|
||||
|
||||
p = null;
|
||||
};
|
||||
//]]>
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user