Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

only try to normalize the units to px on IE if it's not directly set …

…on the style attribute
  • Loading branch information...
commit c1e27a53725073edca429a155f2d9523c3ac49e1 1 parent 4d6b2af
@gonchuki authored
View
2  Source/Element/Element.Style.js
@@ -142,7 +142,7 @@ Element.implement({
if (color) result = result.replace(color[0], color[0].rgbToHex());
}
if (Browser.opera || Browser.ie){
- if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){
+ if ((/^(height|width)$/).test(property) && !(/px$/.test(result)) && !this.style[property]){
var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
values.each(function(value){
size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
View
8 Specs/1.4client/Element/Element.Style.js
@@ -96,6 +96,14 @@ describe('Element.Style', function(){
it('should get the width from the CSS', function(){
expect(element.getStyle('width')).toMatch(/\d+px/);
});
+
+ it('should not mangle the units from inline width in %', function(){
+ expect(new Element('div').setStyle('width', '40%').getStyle('width')).toEqual('40%');
+ });
+
+ it('should not mangle the units from inline auto width', function(){
+ expect(new Element('div').setStyle('width', 'auto').getStyle('width')).toEqual('auto');
+ });
it('should get the left margin from the CSS', function(){
// FireFox returns px (and maybe even as floats)

0 comments on commit c1e27a5

Please sign in to comment.
Something went wrong with that request. Please try again.