Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 8b89763

Browse files
committed
Fix -ms-filter calculations for jQuery UI 1.13
jQuery UI 1.13 uses `-ms-filter` which has to have its entire value put in quotes. Fixes jquery/jquery-ui/issues/2190
1 parent af35252 commit 8b89763

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

lib/themeroller.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,18 @@ function ThemeRoller( baseThemeCss, vars, options ) {
9898
vars.opacityShadowPerc = vars.opacityShadow;
9999
if ( options.version && semver.lt( options.version, "1.10.0" ) ) {
100100

101-
// For version < 1.10.0, opacity (w3c) and filter (IE) are combined into the same line.
101+
// For version <1.10.0, opacity (w3c) and filter (IE) are combined
102+
// into the same line.
102103
opacityFix = function( opacity ) {
103104
return /* w3c */ ( opacity / 100 ).toString().replace( /^0\./, "." ) + /* IE */ ";filter:Alpha(Opacity=" + opacity + ")";
104105
};
105106
vars.opacityOverlay = opacityFix( vars.opacityOverlay );
106107
vars.opacityShadow = opacityFix( vars.opacityShadow );
107108

108-
} else {
109+
} else if ( options.version && semver.lt( options.version, "1.13.0" ) ) {
109110

110-
// For version >= 1.10.0, filter has its own separate line and variable name.
111+
// For version >=1.10.0, `filter` has its own separate line
112+
// and variable name.
111113
opacityFix = function( opacity ) {
112114
return ( opacity / 100 ).toString().replace( /^0\./, "." );
113115
};
@@ -118,6 +120,21 @@ function ThemeRoller( baseThemeCss, vars, options ) {
118120
vars.opacityFilterShadow = opacityFilter( vars.opacityShadow );
119121
vars.opacityOverlay = opacityFix( vars.opacityOverlay );
120122
vars.opacityShadow = opacityFix( vars.opacityShadow );
123+
124+
} else {
125+
126+
// For version >=1.13.0, `-ms-filter` has its own separate line
127+
// and variable name.
128+
opacityFix = function( opacity ) {
129+
return ( opacity / 100 ).toString().replace( /^0\./, "." );
130+
};
131+
opacityFilter = function( opacity ) {
132+
return "\"alpha(opacity=" + opacity + ")\"";
133+
};
134+
vars.opacityFilterOverlay = opacityFilter( vars.opacityOverlay );
135+
vars.opacityFilterShadow = opacityFilter( vars.opacityShadow );
136+
vars.opacityOverlay = opacityFix( vars.opacityOverlay );
137+
vars.opacityShadow = opacityFix( vars.opacityShadow );
121138
}
122139

123140
// Add '#' in the beginning of the colors if needed

test/fixtures/jquery-ui-1.13.2/themes/smoothness.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ a.ui-button:active,
438438
.ui-widget-overlay {
439439
background: #aaaaaa;
440440
opacity: .3;
441-
-ms-filter: Alpha(Opacity=30); /* support: IE8 */
441+
-ms-filter: "alpha(opacity=30)"; /* support: IE8 */
442442
}
443443
.ui-widget-shadow {
444444
-webkit-box-shadow: -8px -8px 8px #aaaaaa;

0 commit comments

Comments
 (0)