Opera9.6's stubborn bug

Source: Internet
Author: User

Let's talk about the bug opera10 that has been fixed.

 

Divelement is a div element default style width: 100px; border-width: 0:

Window. setTimeout (function () {divelement. style. borderwidth = '20px ';}, 100 );
When the setTimeout callback is used to change the borderwidth of a DIV, opera9 does not re-render, which means it looks unchanged.

Re-rendering is performed only when the focus is switched to another window and then switched back.

I want to force him to re-render. But the problem is that opera9 has a cache mechanism to reduce reflow.

For example, I:

Window. setTimeout (function () {divelement. style. borderwidth = '20px '; divelement. style. width = '1000px' ;}, 100 );
In this way, the rendering is re-performed.
Border also changed

But once it is changed back to the original width

Border is gone.
So it doesn't seem to work to force a new rendering after the border is changed.

For example:

Window. setTimeout (function (){
Show. style. borderwidth = '20px ';
Show. style. width = '1000px '; // force re-rendering. The border change is displayed.
Show. style. width = '100px '; // restore the original width. At this time, the border becomes the original 0.
},100 );

Or

Window. setTimeout (function (){
Show. style. width = '101px ';
Show. style. borderwidth = '20px ';
Show. style. width = '100px ';

},100 );

None

 

Solution:

Window. setTimeout (function (){
Show. style. width = '101px ';
Show. style. borderwidth = '20px ';
Window. setTimeout (function () {Show. style. width = '100px ';}, 0 );
},100 );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.