i'm trying to fix this forum where html entities are not displayed correctly. since the o开发者_C百科wner is m.i.a. i'm trying to do this with an extension.
what i see on my screen:
euro:€
pound:£
view of the html DOM with firebug
my code:
GM_log('before text= '+text);
text.replace( /amp;/gi, function( $0 ) {
GM_log('$0= '+$0);
fix="";
return fix;
});
GM_log(' after text= '+text);
which returns:
before text= euro: &#8364; <br>pound: &#163;
$0= amp;
$0= amp;
after text= euro: &#8364; <br>pound: &#163;
so my code seems to be working until the point it has to replace.
are those rectangles preventing it? did i do something wrong?
and if so how can i fix this?
thanks.
You forgot to assign the result of replace
:
text = text.replace(...);
精彩评论