PDA

View Full Version : [CLOSED]Ext.Element.getStyle set display style property side-effect on webkit



imat
31 May 2010, 6:34 AM
I ran into a webkit specific bug where my elements where added an extra display style (style="display:none;")
After some debugging I found what I think is a bug in the Ext.Element.getStyle method.
Here is the change to fix (always set back display from currentStyle)



prop = chkCache(prop);
// Fix bug caused by this: https://bugs.webkit.org/show_bug.cgi?id=13343
if(wk && /marginRight/.test(prop)){
- display = this.getStyle('display');
+ display = el.style.display;
el.style.display = 'inline-block';
}
out = (v = el.style[prop]) ? v :

evant
31 May 2010, 4:46 PM
Please follow the guidelines when posting to the bug forum: http://www.extjs.com/forum/showthread.php?71015-Posting-to-the-Bug-Forum

Thanks.

imat
1 Jun 2010, 4:46 AM
Ext version tested:


Ext 3.2.0
Ext 3.2.1
Ext core 3.1.0

Adapter used:


ext

Browser versions tested against:


Chrome 5.0
Chrome 4.0
Safari 4.0.5

Operating System:


WinXP Pro

Description:


calling Ext.Element.getStyle('marginRight') on webkit browsers have the side effect of adding a display property in the style="" attribute.


Test Case:



<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script>
<script type="text/javascript">
Ext.onReady(function(){

var e = document.createElement('div');
console.assert( ! e.style.display, 'no style.display set on element' );
Ext.get(e).getStyle('marginRight');
console.assert( ! e.style.display, 'getStyle() should produce no side-effect on style.display' );

});
</script>

</head>
<body>
</body>
</html>


Steps to reproduce the problem:


see test case


The result that was expected:


getStyle('marginRight') does not produce side-effect


The result that occurs instead:


the style property of the element is altered to include its computed display.


Possible fix:


@@ -5941,7 +5941,7 @@
prop = chkCache(prop);
// Fix bug caused by this: https://bugs.webkit.org/show_bug.cgi?id=13343
if(wk && /marginRight/.test(prop)){
- display = this.getStyle('display');
+ display = el.style.display;
el.style.display = 'inline-block';
}
out = (v = el.style[prop]) ? v :

evant
1 Jun 2010, 6:18 AM
Right ok, this has since been fixed in SVN, which is why I was a bit confused. I'll mark this as closed.

Thanks for the report.

imat
28 Jul 2010, 5:46 AM
I'm curious, do you know in which svn revision it was fixed ?
I still have the issue with 3.2.2.

Also, I tried to build the trunk to test this,
but JSBulder2 was not working for me ...


$ java -jar JSBuilder2.jar -p ext-core.jsb2 -d ../out
Loading the 'Ext Core' Project
Loaded 2 Packages
java.io.FileNotFoundException: null\src\ext-core\src\core\Ext.js (The system can
not find the path specified)
[.. repeat for each files ...]
java.io.FileNotFoundException: null\src (The system cannot find the path specifi
ed)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at com.extjs.FileHelper.copyDirectory(FileHelper.java:76)
at com.extjs.JSBuilder2.copyResources(JSBuilder2.java:387)
at com.extjs.JSBuilder2.main(JSBuilder2.java:43)
Compressing output files...

Jamie Avins
28 Jul 2010, 2:15 PM
Looks like 225/226 is when it was fixed in the 3.3.x branch in core. Not sure about your building problem, there may be an issue in the core jsb2 file we're not aware of as we haven't created a separate core build in a little while now.

imat
29 Jul 2010, 9:32 AM
Ah in the 3.3.x branch, thanks :-)

yeah for jsbuilder2 I dont know, I just extracted the jar from http://www.sencha.com/products/jsbuilder/
and ran the above command, same results on any jsb2 file i've tried, using java -version 1.6.0_20.

I looked at the revision and it doesnt look like it would have fixed the bug to me.
Problem is that it use getComputedStyle to record previous state and el.style to reset it after.

This is an important to me as it makes my app unusable (makes node sticky display:none)
I'll try jsbuilder2 on another machine and stuff to try to build that;
but please let me know if theres anything else I could do to help test.