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

IE filter property #15

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions lib/themeroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,33 @@ function ThemeRoller( baseThemeCss, vars, options ) {

} else {

// For version >= 1.10.0, filter has its own separate line and variable name.
opacityFix = function( opacity ) {
return ( opacity / 100 ).toString().replace( /^0\./, "." );
};
opacityFilter = function( opacity ) {
return "Alpha(Opacity=" + opacity + ")";
};
vars.opacityFilterOverlay = opacityFilter( vars.opacityOverlay );
vars.opacityFilterShadow = opacityFilter( vars.opacityShadow );
vars.opacityOverlay = opacityFix( vars.opacityOverlay );
vars.opacityShadow = opacityFix( vars.opacityShadow );
if ( options.version && semver.lt( options.version, "1.13.0" ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve just noticed - don’t nest this all within the else above, just use else if. That will help avoid all these indentation changes below as well.


// For version >= 1.10.0 < 1.13.0, filter has its own separate line and variable name.
opacityFix = function( opacity ) {
return ( opacity / 100 ).toString().replace( /^0\./, "." );
};
opacityFilter = function( opacity ) {
return "Alpha(Opacity=" + opacity + ")";
};
vars.opacityFilterOverlay = opacityFilter( vars.opacityOverlay );
vars.opacityFilterShadow = opacityFilter( vars.opacityShadow );
vars.opacityOverlay = opacityFix( vars.opacityOverlay );
vars.opacityShadow = opacityFix( vars.opacityShadow );
}
else {
// For version >= 1.13.0, filter has its own separate line and variable name.
opacityFix = function( opacity ) {
return ( opacity / 100 ).toString().replace( /^0\./, "." );
};
opacityFilter = function( opacity ) {
return "alpha(opacity=" + opacity + ")";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still no quotes wrapping the whole value here. -ms-filter requires them.

};
vars.opacityFilterOverlay = opacityFilter( vars.opacityOverlay );
vars.opacityFilterShadow = opacityFilter( vars.opacityShadow );
vars.opacityOverlay = opacityFix( vars.opacityOverlay );
vars.opacityShadow = opacityFix( vars.opacityShadow );
}
}

// Add '#' in the beginning of the colors if needed
Expand Down
10 changes: 5 additions & 5 deletions test/fixtures/jquery-ui-1.12/base/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,18 @@
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70); /* support: IE8 */
filter: "alpha(opacity=70)"; /* support: IE8 */
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35); /* support: IE8 */
filter: "alpha(opacity=35)"; /* support: IE8 */
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
filter: "alpha(opacity=35)"; /* support: IE8 - See #6059 */
}

/* Icons
Expand Down Expand Up @@ -398,13 +398,13 @@
.ui-widget-overlay {
background: #aaaaaa/*{bgColorOverlay}*/ url("images/ui-bg_flat_0_aaaaaa_40x100.png")/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/;
opacity: .3/*{opacityOverlay}*/;
filter: Alpha(Opacity=30)/*{opacityFilterOverlay}*/; /* support: IE8 */
filter: "alpha(opacity=30)"/*{opacityFilterOverlay}*/; /* support: IE8 */
}
.ui-widget-shadow {
margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/;
padding: 8px/*{thicknessShadow}*/;
background: #aaaaaa/*{bgColorShadow}*/ url("images/ui-bg_flat_0_aaaaaa_40x100.png")/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/;
opacity: .3/*{opacityShadow}*/;
filter: Alpha(Opacity=30)/*{opacityFilterShadow}*/; /* support: IE8 */
filter: "alpha(opacity=30)"/*{opacityFilterShadow}*/; /* support: IE8 */
border-radius: 8px/*{cornerRadiusShadow}*/;
}
10 changes: 5 additions & 5 deletions test/fixtures/jquery-ui-1.12/themes/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,18 @@
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70); /* support: IE8 */
filter: "alpha(opacity=70)"; /* support: IE8 */
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35); /* support: IE8 */
filter: "alpha(opacity=35)"; /* support: IE8 */
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
filter: "alpha(opacity=35)"; /* support: IE8 - See #6059 */
}

/* Icons
Expand Down Expand Up @@ -398,13 +398,13 @@
.ui-widget-overlay {
background: #aaaaaa;
opacity: .3;
filter: Alpha(Opacity=30); /* support: IE8 */
filter: "alpha(opacity=30)"; /* support: IE8 */
}
.ui-widget-shadow {
margin: 0px 0 0 0px;
padding: 5px;
background: #666666;
opacity: .3;
filter: Alpha(Opacity=30); /* support: IE8 */
filter: "alpha(opacity=30)"; /* support: IE8 */
border-radius: 8px;
}