Klaus Hartl schrieb:
> Brian Miller schrieb:
>   
>> Is this patch generalized enough to add to the core?  Just a thought...
>>     
>
> Brian, it's actually just a check if the object is not null before 
> accessing it:
>
> As it is:
> ret =
> document.defaultView.getComputedStyle(this,null).getPropertyValue(prop);
>
>
> The patch (with Dave's proposal to avoid two calls):
>
> var computedStyle = document.defaultView.getComputedStyle(this, null);
> ret = computedStyle && computedStyle.getPropertyValue(prop);
>
> I think that one does no harm. ret may be null in certain cases in 
> Safari but that's better than throwing a nullpointer, right?
>
> It could also return an empty string if that's more robust:
> ret = computedStyle && computedStyle.getPropertyValue(prop) || '';
>   
Could you file that as a bug report if you think it should be fixed in core?

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to