|
fun fact: in chrome, those linebreaks in textContent might come back if you first set the container's white-wpace to "pre" or "pre-wrap" or "pre-line". Surprisingly, this affects textareas as well; a fact which burned me for years before i figured out what was going on.
silly question comes to mind:
after hearing about your linebreak and dom issues, i have to ask; are you using google's translate API?
if so, it expects plain text, and it preserves line breaks just fine. You would use a textarea to send a string back and forth to google. This works simply and perfectly.
If you are using some kind of hack where google is trying to translate an HTML page you publish, that's going to be a lot trickier and google can change their formatting at the drop of a hat, breaking your script.
bottom line, use APIs and you will have FAR fewer inconsistencies like you've noted.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:15.2% IE7:0.5% IE8:8.4% IE9:8.5% IE10:8.5%
|