Answer the question
In order to leave comments, you need to log in
Why doesn't innerHTML redraw the page in IE?
Hello!
According to the task, I need to change the content inside the text tag, then measure the length and do some calculations, in Chrome, FF everything is buzzing, problems only in IE
I gave an example:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<span>Span</span>
<svg width="620" height="100">
<text x="30" y="90" fill="#ED6E46" font-size="100" font-family="'Leckerli One', cursive">Text</text>
</svg>
</body>
<script>
var text = document.getElementsByTagName('text')[0];
var span = document.getElementsByTagName('span')[0];
console.log('text length1: ' + text.getComputedTextLength());
text.innerHTML = 'NewText'
span.innerHTML = 'NewText'
console.log('text: ' + text.innerHTML);
console.log('span: ' + span.innerHTML);
console.log('text length2: ' + text.getComputedTextLength());
</script>
</html>
Answer the question
In order to leave comments, you need to log in
text.textContent = 'NewText';
jsfiddle.net/heL0114p/1
That's why stackoverflow.com/questions/4282108/how-to-change-...
For those who don't have enoughtextContent
https://github.com/dnozay/innersvg-polyfill
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question