Ticket #6686: getStyle.diff
| File getStyle.diff, 1.9 kB (added by Tobie, 2 years ago) |
|---|
-
test/unit/dom.html
old new 11 11 /* <![CDATA[ */ 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 17 17 #not_floating_style { float: none } … … 452 452 assertEqual('alpha(opacity=30)', $('op3').getStyle('filter')); 453 453 assertEqual(0.3, $('op4-ie').getStyle('opacity')); 454 454 } 455 455 // verify that value is stil found when using camelized 456 // strings (function previously used getPropertyValue() 457 // which expected non-camelized strings) 458 assertEqual("12px", $('style_test_1').getStyle('fontSize')); 456 459 }}, 457 460 458 461 testElementReadAttribute: function() {with(this) { -
src/dom.js
old new 283 283 284 284 getStyle: function(element, style) { 285 285 element = $(element); 286 var inline = (style == 'float' ?286 var camelizedStyle = (style == 'float' ? 287 287 (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat') : style).camelize(); 288 var value = element.style[ inline];288 var value = element.style[camelizedStyle]; 289 289 if (!value) { 290 290 if (document.defaultView && document.defaultView.getComputedStyle) { 291 291 var css = document.defaultView.getComputedStyle(element, null); 292 value = css ? css .getPropertyValue(style): null;292 value = css ? css[camelizedStyle] : null; 293 293 } else if (element.currentStyle) { 294 value = element.currentStyle[ inline];294 value = element.currentStyle[camelizedStyle]; 295 295 } 296 296 } 297 297