mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Less letterSpacing .animate() fail in IE. Fixes #8627
This commit is contained in:
parent
5d25f78291
commit
b9b87d53c6
15
src/css.js
15
src/css.js
@ -15,7 +15,13 @@ var curCSS, iframe, iframeDoc,
|
|||||||
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
|
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
|
||||||
rposition = /^(top|right|bottom|left)$/,
|
rposition = /^(top|right|bottom|left)$/,
|
||||||
|
|
||||||
eventsToggle = jQuery.fn.toggle;
|
eventsToggle = jQuery.fn.toggle,
|
||||||
|
|
||||||
|
cssNormalTransform = {
|
||||||
|
letterSpacing: 0,
|
||||||
|
fontWeight: 400,
|
||||||
|
lineHeight: 1
|
||||||
|
};
|
||||||
|
|
||||||
// return a css property mapped to a potentially vendor prefixed property
|
// return a css property mapped to a potentially vendor prefixed property
|
||||||
function vendorPropName( style, name ) {
|
function vendorPropName( style, name ) {
|
||||||
@ -235,8 +241,13 @@ jQuery.extend({
|
|||||||
val = curCSS( elem, name );
|
val = curCSS( elem, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//convert "normal" to computed value
|
||||||
|
if ( val === "normal" && name in cssNormalTransform ) {
|
||||||
|
val = cssNormalTransform[ name ];
|
||||||
|
}
|
||||||
|
|
||||||
// Return, converting to number if forced or a qualifier was provided and val looks numeric
|
// Return, converting to number if forced or a qualifier was provided and val looks numeric
|
||||||
if ( numeric || extra ) {
|
if ( numeric || extra !== undefined ) {
|
||||||
num = parseFloat( val );
|
num = parseFloat( val );
|
||||||
return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
|
return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
|
||||||
}
|
}
|
||||||
|
15
src/effects.js
vendored
15
src/effects.js
vendored
@ -365,19 +365,20 @@ Tween.prototype.init.prototype = Tween.prototype;
|
|||||||
Tween.propHooks = {
|
Tween.propHooks = {
|
||||||
_default: {
|
_default: {
|
||||||
get: function( tween ) {
|
get: function( tween ) {
|
||||||
var parsed, result;
|
var result;
|
||||||
|
|
||||||
if ( tween.elem[ tween.prop ] != null &&
|
if ( tween.elem[ tween.prop ] != null &&
|
||||||
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
|
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
|
||||||
return tween.elem[ tween.prop ];
|
return tween.elem[ tween.prop ];
|
||||||
}
|
}
|
||||||
|
|
||||||
result = jQuery.css( tween.elem, tween.prop );
|
// passing any value as a 4th paramter to .css will automatically
|
||||||
// Empty strings, null, undefined and "auto" are converted to 0,
|
// attempt a parseFloat and fallback to a string if the parse fails
|
||||||
// complex values such as "rotate(1rad)" are returned as is,
|
// so, simple values such as "10px" are parsed to Float.
|
||||||
// simple values such as "10px" are parsed to Float.
|
// complex values such as "rotate(1rad)" are returned as is.
|
||||||
return isNaN( parsed = parseFloat( result ) ) ?
|
result = jQuery.css( tween.elem, tween.prop, false, "" );
|
||||||
!result || result === "auto" ? 0 : result : parsed;
|
// Empty strings, null, undefined and "auto" are converted to 0.
|
||||||
|
return !result || result === "auto" ? 0 : result;
|
||||||
},
|
},
|
||||||
set: function( tween ) {
|
set: function( tween ) {
|
||||||
// use step hook for back compat - use cssHook if its there - use .style if its
|
// use step hook for back compat - use cssHook if its there - use .style if its
|
||||||
|
@ -732,6 +732,14 @@ test("css('width') and css('height') should respect box-sizing, see #11004", fun
|
|||||||
equal( el_dis.css("height"), el_dis.css("height", el_dis.css("height")).css("height"), "css('height') is not respecting box-sizing for disconnected element, see #11004");
|
equal( el_dis.css("height"), el_dis.css("height", el_dis.css("height")).css("height"), "css('height') is not respecting box-sizing for disconnected element, see #11004");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("certain css values of 'normal' should be convertable to a number, see #8627", function() {
|
||||||
|
var el = jQuery("<div style='letter-spacing:normal;font-weight:normal;line-height:normal;'>test</div>").appendTo("#qunit-fixture");
|
||||||
|
|
||||||
|
ok( jQuery.isNumeric( parseFloat( el.css("letterSpacing") ) ), "css('letterSpacing') not convertable to number, see #8627" );
|
||||||
|
ok( jQuery.isNumeric( parseFloat( el.css("fontWeight") ) ), "css('fontWeight') not convertable to number, see #8627" );
|
||||||
|
ok( jQuery.isNumeric( parseFloat( el.css("lineHeight") ) ), "css('lineHeight') not convertable to number, see #8627" );
|
||||||
|
});
|
||||||
|
|
||||||
test( "cssHooks - expand", function() {
|
test( "cssHooks - expand", function() {
|
||||||
expect( 15 );
|
expect( 15 );
|
||||||
var result,
|
var result,
|
||||||
|
Loading…
Reference in New Issue
Block a user