Skip to content

Commit fff7a1b

Browse files
mgolleobalter
authored andcommitted
Core: Drop workarounds for IE <9
Fixes #89
1 parent 79132a2 commit fff7a1b

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Browser Support
66

7-
jQuery color is tested on the same browsers a jQuery Core 1.x versions. [Check it](http://swarm.jquery.org/project/jquerycolor)
7+
jQuery color is tested on the same browsers a jQuery Core 3.x versions. [Check it](http://swarm.jquery.org/project/jquerycolor)
88

99
## Using jQuery Color in Production
1010
We release jQuery Color by itself, or in a bundle. The extended names can be included as a jQuery Color plugin, or you can download the version of jQuery Color that includes the names. Choose your build from the following list:

jquery.color.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,13 @@
131131
floor: true
132132
}
133133
},
134-
support = color.support = {},
135-
136-
// element for support tests
137-
supportElem = jQuery( "<p>" )[ 0 ],
138134

139135
// colors = jQuery.Color.names
140136
colors,
141137

142138
// local aliases of functions called often
143139
each = jQuery.each;
144140

145-
// determine rgba support immediately
146-
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
147-
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
148-
149141
// define cache name and alpha properties
150142
// for rgba and hsla spaces
151143
each( spaces, function( spaceName, space ) {
@@ -167,12 +159,6 @@ function clamp( value, prop, allowEmpty ) {
167159
// ~~ is an short way of doing floor for positive numbers
168160
value = type.floor ? ~~value : parseFloat( value );
169161

170-
// IE will pass in empty strings as value for alpha,
171-
// which will hit this case
172-
if ( isNaN( value ) ) {
173-
return prop.def;
174-
}
175-
176162
if ( type.mod ) {
177163
// we add mod before modding to make sure that negatives values
178164
// get converted properly: -10 -> 350
@@ -420,8 +406,7 @@ color.fn = jQuery.extend( color.prototype, {
420406
return "#" + jQuery.map( rgba, function( v ) {
421407

422408
// default to 0 when nulls exist
423-
v = ( v || 0 ).toString( 16 );
424-
return v.length === 1 ? "0" + v : v;
409+
return ( "0" + ( v || 0 ).toString( 16 ) ).substr( -2 );
425410
}).join("");
426411
},
427412
toString: function() {
@@ -586,36 +571,13 @@ color.hook = function( hook ) {
586571
each( hooks, function( i, hook ) {
587572
jQuery.cssHooks[ hook ] = {
588573
set: function( elem, value ) {
589-
var parsed, curElem,
590-
backgroundColor = "";
574+
var parsed;
591575

592576
if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
593577
value = color( parsed || value );
594-
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
595-
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
596-
while (
597-
(backgroundColor === "" || backgroundColor === "transparent") &&
598-
curElem && curElem.style
599-
) {
600-
try {
601-
backgroundColor = jQuery.css( curElem, "backgroundColor" );
602-
curElem = curElem.parentNode;
603-
} catch ( e ) {
604-
}
605-
}
606-
607-
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
608-
backgroundColor :
609-
"_default" );
610-
}
611-
612578
value = value.toRgbaString();
613579
}
614-
try {
615-
elem.style[ hook ] = value;
616-
} catch( e ) {
617-
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
618-
}
580+
elem.style[ hook ] = value;
619581
}
620582
};
621583
jQuery.fx.step[ hook ] = function( fx ) {

0 commit comments

Comments
 (0)