Changeset 5659
- Timestamp:
- 12/01/06 14:16:44 (2 years ago)
- Files:
-
- spinoffs/prototype/CHANGELOG (modified) (1 diff)
- spinoffs/prototype/src/dom.js (modified) (1 diff)
- spinoffs/prototype/test/unit/dom.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/prototype/CHANGELOG
r5650 r5659 1 * Make Element.getStyle() work with camelCased argument, fixes #6686 [Tobie] 2 1 3 * Fix a redundant check in Array.prototype.compact, fixes #4739 [wlodarcz, mislav] 2 4 spinoffs/prototype/src/dom.js
r5649 r5659 283 283 getStyle: function(element, style) { 284 284 element = $(element); 285 var inline = (style == 'float' ?285 var camelizedStyle = (style == 'float' ? 286 286 (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat') : style).camelize(); 287 var value = element.style[ inline];287 var value = element.style[camelizedStyle]; 288 288 if (!value) { 289 289 if (document.defaultView && document.defaultView.getComputedStyle) { 290 290 var css = document.defaultView.getComputedStyle(element, null); 291 value = css ? css .getPropertyValue(style): null;291 value = css ? css[camelizedStyle] : null; 292 292 } else if (element.currentStyle) { 293 value = element.currentStyle[ inline];293 value = element.currentStyle[camelizedStyle]; 294 294 } 295 295 } spinoffs/prototype/test/unit/dom.html
r5649 r5659 12 12 #testcss1 { font-size:11px; color: #f00; } 13 13 #testcss2 { font-size:12px; color: #0f0; display: none; } 14 #style_test_1 { cursor: pointer }14 #style_test_1 { cursor: pointer; font-size:12px;} 15 15 div.style-test { margin-left: 1px } 16 16 … … 456 456 assertEqual(0.3, $('op4-ie').getStyle('opacity')); 457 457 } 458 458 // verify that value is stil found when using camelized 459 // strings (function previously used getPropertyValue() 460 // which expected non-camelized strings) 461 assertEqual("12px", $('style_test_1').getStyle('fontSize')); 459 462 }}, 460 463