From c5e8e12cef31fee89965891669ecdca6436be319 Mon Sep 17 00:00:00 2001 From: Zheming Sun Date: Sat, 8 Nov 2014 17:53:12 +0300 Subject: [PATCH] CSS: Fix get upper case alpha opacity in IE8 Fixes gh-1705 Closes gh-1704 --- src/css.js | 2 +- test/data/testsuite.css | 7 +++++++ test/unit/css.js | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/css.js b/src/css.js index 75e74228c..c434fd1b7 100644 --- a/src/css.js +++ b/src/css.js @@ -22,7 +22,7 @@ var // BuildExclude getStyles = curCSS.getStyles, ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, + ropacity = /opacity\s*=\s*([^)]*)/i, // swappable if display is none or starts with table except // "table", "table-cell", or "table-caption" diff --git a/test/data/testsuite.css b/test/data/testsuite.css index 545d8ce5d..d9909ddcc 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -156,3 +156,10 @@ section { background:#f0f; display:block; } #span-14824 { display: block; } #display { display: list-item !important; } + +/* fix get alpha opacity in IE8 */ +.fix-get-alpha-opacity-in-ie8 { + opacity: 0.5; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; +} + diff --git a/test/unit/css.js b/test/unit/css.js index 5121074fc..364249a31 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1151,4 +1151,17 @@ test( "Do not throw on frame elements from css method (#15098)", 1, function() { ok( false, "It did throw" ); } }); + +test( "get upper case alpha opacity in IE8", 1, function() { + var div = document.createElement( "div" ), + fixture = document.getElementById( "qunit-fixture" ); + + div.className = "fix-get-alpha-opacity-in-ie8"; + fixture.appendChild( div ); + + equal( jQuery( div ).css( "opacity" ), "0.5", "get upper case alpha opacity in IE8 ok" ); + + fixture.removeChild( div ); +}); + } -- 2.39.5