I have some trivial JavaScript to effect a style change:
sel = document.getElementById('my_id');
sel.className = sel.className.replace(/item-[1-9]-selected/,'item-1-selected');
return false;
This works fine with the latest versions of FF, Opera and IE, but fails on the latest versions of Chrome and Safari.
It affects two descendants, which happen to be siblings. The first sibling updates, but the second doesn’t. A child of the second element also has focus and contains the <a> tag that contains the above code in an onclick attribute.
In the Chrome “Developer Tools” window if I nudge (e.g. uncheck & check) any attribute of any element, the second sibling updates to the correct style.
Is there a workaround to easily and programmatically “nudge” WebKit into doing the right thing?
the "display/offsetHeight" hack didn't work in my case, at least when it was applied to the element being animated.
i had a dropdown menu that was being open/closed over the page content. the artifacts were being left on the page content after the menu had closed (only in webkit browsers). the only way the "display/offsetHeight" hack worked is if i applied it to the body, which seems nasty.
however, i did find another solution:
this is still pretty hacky (it uses a CSS3 property to force hardware rendering), but at least it only affects the element in question, and worked for me on both safari and chrome on PC and Mac.
danorton solution didn't work for me. I had some really weird problems where webkit wouldn't draw some elements at all; where text in inputs wasn't updated until onblur; and changing className would not result in a redraw.
My solution, I accidentally discovered, was to add a empty style element to the body, after the script.
That fixed it. How weird is that? Hope this is helpful for someone.
I am working on ionic html5 app, on few screens i have
absolute
positioned element, when scroll up or down in IOS devices (iPhone 4,5,6, 6+)i had repaint bug.Tried many solution none of them was working except this one solve my problem.
I have use css class
.fixRepaint
on those absolute positions elementsThis has fixed my problem, it may be help some one
I was having an issue with an SVG that was disappearing on Chrome for Android when the orientation was changed in certain circumstances. The below code doesn't reproduce it, but is the setup we had.
Day and half later after poking and prodding and not happy with the hacky solutions offered here, I discovered that the issue was caused by the fact it seemed to keep the element in memory while drawing a new one. The solution was to make the ID of the linearGradient on the SVG unique, even though it was only ever used once per page.
This can be achieved many different ways, but for our angular app we used lodash uniqueId function to add a variable to the scope:
Angular Directive (JS):
HTML Updates:
Line 5:
<linearGradient ng-attr-id="{{indicatorColourPatternId}}" x1="0" x2="0" y1="0" y2="1">
Line 11:
<rect x="0" y="0" rx="5" ry="5" width="100%" height="100%" ng-attr-fill="url(#{{indicatorColourPatternId}})"/>
I hope this answer saves someone else a days worth of face-smashing their keyboard.
I had this problem with a a number of divs that were inserted in another div with
position: absolute
, the inserted divs had no position attribute. When I changed this toposition:relative
it worked fine. (was really hard to pinpoint the problem)In my case the elements where inserted by Angular with
ng-repeat
.I've found this method to be useful when working with transitions