Version: (using KDE KDE 3.3.0) Installed from: RedHat RPMs OS: Linux When you modify the border attribute of a img tag with javascript, the khtml engine doesn't refresh the display for this image. For instance, when you set the border, which was previously set to 0, to 3, a border appears in the display (normal behavior). When you set it again to 0; the image border doesn't disappear, even if checking the img border property with javascript shows the right value (0).
Here is a example:<html> <head> <title>KHTML Javascript Bug</title> <script language="javascript" type="text/javascript"> function setImgBorder() { if (document.images.unxbsd.border == 3) { document.images.unxbsd.border = 0; } else if (document.images.unxbsd.border == 0) { document.images.unxbsd.border = 3; } else { alert('no way'); } alert('The img border is ' + document.images.unxbsd.border); } </script> </head> <body> <form> <h1>KHTML Javascript Bug</h1> <p/> <img alt="KDE Homepage" src="http://www.kde.org/media/images/kde_logo.jpg" name="unxbsd" width="296" height="79" border="0" /> <p/> <input type="button" value="Change Img border" onClick="setImgBorder()" /> </form> </body> </html>
Created attachment 7588 [details] Testcase mentioned above
Confirmed. Setting the border works. Clearing the border doesn't.
Confirmed. With border > 0 it just works as expected. Could it be possible, that the problem is located at kdelibs/html/html/html_imageimpl.cpp line 95 at the if(attr->value().toInt()) condition cause if 0 addCSSLength(CSS_PROP_BORDER_WIDTH, attr->value()); just don't got executed? Just an idear cause other areas like html/html_objectimpl.cpp line 262 don't check if attr->value().toInt() == 0 :-)
CVS commit by ggarand: remove CSS border properties when our image's border attribute translates to zero. BUG: 88727 M +6 -0 html_imageimpl.cpp 1.151 --- kdelibs/khtml/html/html_imageimpl.cpp #1.150:1.151 @@ -99,4 +99,10 @@ void HTMLImageElementImpl::parseAttribut addCSSProperty( CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_SOLID ); addCSSProperty( CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_SOLID ); + } else { + removeCSSProperty( CSS_PROP_BORDER_WIDTH ); + removeCSSProperty( CSS_PROP_BORDER_TOP_STYLE ); + removeCSSProperty( CSS_PROP_BORDER_RIGHT_STYLE ); + removeCSSProperty( CSS_PROP_BORDER_BOTTOM_STYLE ); + removeCSSProperty( CSS_PROP_BORDER_LEFT_STYLE ); } break;