Permalink
Browse files

baidu.dom.getStyle

[Bugfix] 单位不统一
统一baidu.dom._styleFixer.width和height的单位为px
  • Loading branch information...
1 parent a146386 commit 3cd5e724ff67897c4acb1443069841c7a2e09a9c @aJean aJean committed Mar 20, 2012
Showing with 4 additions and 5 deletions.
  1. +2 −2 src/baidu/dom/_styleFixer/height.js
  2. +2 −2 src/baidu/dom/_styleFixer/width.js
  3. +0 −1 src/baidu/dom/getStyle.js
View
4 src/baidu/dom/_styleFixer/height.js
@@ -18,9 +18,9 @@ baidu.dom._styleFixer.height = {
get: function(element, value) {
var val = element.offsetHeight;
if (val > 0) {
- return val;
+ return val + 'px';
}else {
- return !value || value == 'auto' ? 0 : val;
+ return !value || value == 'auto' ? 0 + 'px' : val;
}
},
View
4 src/baidu/dom/_styleFixer/width.js
@@ -18,9 +18,9 @@ baidu.dom._styleFixer.width = {
get: function(element, value) {
var val = element.offsetWidth;
if (val > 0) {
- return val;
+ return val + 'px';
}else {
- return !value || value == 'auto' ? 0 : val;
+ return !value || value == 'auto' ? 0 + 'px' : val;
}
},
View
1 src/baidu/dom/getStyle.js
@@ -8,7 +8,6 @@
///import baidu.dom._styleFixer;
///import baidu.dom._styleFilter.filter;
///import baidu.string.toCamelCase;
-///import baidu.dom._styleFixer.width;
/**
* 获取目标元素的样式值

0 comments on commit 3cd5e72

Please sign in to comment.