|
2792 | 2792 |
|
2793 | 2793 |
|
2794 | 2794 | /**
|
2795 |
| - * Element.getStyle(@element, style) -> String | null |
| 2795 | + * Element.getStyle(@element, style) -> String | Number | null |
2796 | 2796 | * - style (String): The property name to be retrieved.
|
2797 | 2797 | *
|
2798 | 2798 | * Returns the given CSS property value of `element`. The property can be
|
|
2805 | 2805 | * (fully transparent) and `1` (fully opaque), position properties
|
2806 | 2806 | * (`left`, `top`, `right` and `bottom`) and when getting the dimensions
|
2807 | 2807 | * (`width` or `height`) of hidden elements.
|
| 2808 | + * |
| 2809 | + * If a value is present, it will be returned as a string — except |
| 2810 | + * for `opacity`, which returns a number between `0` and `1` just as |
| 2811 | + * [[Element.getOpacity]] does. |
2808 | 2812 | *
|
2809 | 2813 | * ##### Examples
|
2810 | 2814 | *
|
|
2915 | 2919 | value = element.currentStyle[style];
|
2916 | 2920 | }
|
2917 | 2921 |
|
2918 |
| - if (style === 'opacity' && !STANDARD_CSS_OPACITY_SUPPORTED) |
2919 |
| - return getOpacity_IE(element); |
2920 |
| - |
| 2922 | + if (style === 'opacity') { |
| 2923 | + if (!STANDARD_CSS_OPACITY_SUPPORTED) |
| 2924 | + return getOpacity_IE(element); |
| 2925 | + else return value ? parseFloat(value) : 1.0; |
| 2926 | + } |
| 2927 | + |
2921 | 2928 | if (value === 'auto') {
|
2922 | 2929 | // If we need a dimension, return null for hidden elements, but return
|
2923 | 2930 | // pixel values for visible elements.
|
|
3006 | 3013 |
|
3007 | 3014 |
|
3008 | 3015 | /**
|
3009 |
| - * Element.getOpacity(@element) -> String | null |
| 3016 | + * Element.getOpacity(@element) -> Number | null |
3010 | 3017 | *
|
3011 | 3018 | * Returns the opacity of the element.
|
3012 | 3019 | **/
|
|
0 commit comments