mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Got .css() working in Safari 2 as well (a number of shortcuts had to be removed, unfortunately). This should successfully close bug #1349.
This commit is contained in:
parent
3c82f8fb4a
commit
17949afc34
23
src/jquery/jquery.js
vendored
23
src/jquery/jquery.js
vendored
@ -1457,8 +1457,16 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
curCSS: function(elem, prop, force) {
|
curCSS: function(elem, prop, force) {
|
||||||
var ret, getComputedStyle = document.defaultView &&
|
var ret, stack = [], swap = [];
|
||||||
document.defaultView.getComputedStyle, stack = [], swap = [];
|
|
||||||
|
// A helper method for determining if an element's values are broken
|
||||||
|
function color(a){
|
||||||
|
if ( !jQuery.browser.safari )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var ret = document.defaultView.getComputedStyle(a,null);
|
||||||
|
return !ret || ret.getPropertyValue("color") == "";
|
||||||
|
}
|
||||||
|
|
||||||
if (prop == "opacity" && jQuery.browser.msie) {
|
if (prop == "opacity" && jQuery.browser.msie) {
|
||||||
ret = jQuery.attr(elem.style, "opacity");
|
ret = jQuery.attr(elem.style, "opacity");
|
||||||
@ -1471,13 +1479,13 @@ jQuery.extend({
|
|||||||
if (!force && elem.style[prop])
|
if (!force && elem.style[prop])
|
||||||
ret = elem.style[prop];
|
ret = elem.style[prop];
|
||||||
|
|
||||||
else if (getComputedStyle) {
|
else if (document.defaultView && document.defaultView.getComputedStyle) {
|
||||||
|
|
||||||
if (prop.match(/float/i))
|
if (prop.match(/float/i))
|
||||||
prop = "float";
|
prop = "float";
|
||||||
|
|
||||||
prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
|
prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
|
||||||
var cur = getComputedStyle(elem, null);
|
var cur = document.defaultView.getComputedStyle(elem, null);
|
||||||
|
|
||||||
if ( cur && !color(elem) )
|
if ( cur && !color(elem) )
|
||||||
ret = cur.getPropertyValue(prop);
|
ret = cur.getPropertyValue(prop);
|
||||||
@ -1501,7 +1509,7 @@ jQuery.extend({
|
|||||||
// one special, otherwise get the value
|
// one special, otherwise get the value
|
||||||
ret = prop == "display" && swap[stack.length-1] != null ?
|
ret = prop == "display" && swap[stack.length-1] != null ?
|
||||||
"none" :
|
"none" :
|
||||||
getComputedStyle(elem,null).getPropertyValue(prop) || "";
|
document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || "";
|
||||||
|
|
||||||
// Finally, revert the display styles back
|
// Finally, revert the display styles back
|
||||||
for ( a = 0; a < swap.length; a++ )
|
for ( a = 0; a < swap.length; a++ )
|
||||||
@ -1512,11 +1520,6 @@ jQuery.extend({
|
|||||||
if ( prop == "opacity" && ret == "" )
|
if ( prop == "opacity" && ret == "" )
|
||||||
ret = "1";
|
ret = "1";
|
||||||
|
|
||||||
// A helper method for determining if an element's values are broken
|
|
||||||
function color(a){
|
|
||||||
return jQuery.browser.safari && getComputedStyle(a,null).getPropertyValue("color") == "";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (elem.currentStyle) {
|
} else if (elem.currentStyle) {
|
||||||
var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
|
var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
|
||||||
ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
|
ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
|
||||||
|
Loading…
Reference in New Issue
Block a user