How to force text re-render after padding change from javascript in Chrome?

R

Ry Nohryb

So you've made unfounded inferences about a handful of modern
browsers?  You should write a library.  :)

Yes, I've done it already, I'm the author of My Library ! ;-)
 
D

David Mark

Yes, I've done it already, I'm the author of My Library ! ;-)

Yes, of course you are Jorge. That's fine.

I guess it's official. Anti-MS insurgency leader "El Abuelo" has
officially cracked up. Malaria suspected. Pictures at eleven.
 
S

se

me said:
Fortunately, the bug is easy to detect:

<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
function changePadding(that) {
that.style.padding = "20px 60px";
if (document.getElementById("MyWidthCheck").offsetWidth > 260) {
alert("Text not adapted; forcing render...");
that.style.display = "none";
setTimeout(function() {that.style.display = "";}, 0);
}
}
</SCRIPT>
</HEAD>
<BODY>
<DIV ID="MyContainer" STYLE="width: 360px; background-color: orange;">
<DIV ID="MyContent" STYLE="padding: 20px;" onclick="changePadding(this);">
<H1>Dynamic Padding Test</H1>
<P ID="MyWidthCheck">Click anywhere in this rectangle to change the left
and right padding from 20 to 60 pixels.</P>
</DIV>
</DIV>
</BODY>
</HTML>
Needs to reload the page. Try one of these?
<input type="button" value="Reload Page" onClick="window.location.reload()">
<input type="button" value="Reload Page" onClick="history.go(0)">
<input type="button" value="Reload Page"
onClick="window.location.href=window.location.href">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top