...

View Full Version : Help with refactoring



veearrsix
05-21-2009, 12:40 AM
I've got a few lines of code, that I don't seem to be able to refactor (not sure if its a mental block or stupidity!)


var roundCorners = true;

roundCorners = 'MozOpacity' in document.body.style ? false : roundCorners;
roundCorners = 'WebkitOpacity' in document.body.style ? false : roundCorners;

I'm 100% sure theres a better way to do this, anyone wanna give me a kick in the *** with some suggestions....

Cheers

veearrsix

venegal
05-21-2009, 01:31 AM
Something like

var roundCorners = ('MozOpacity' in document.body.style) || ('WebkitOpacity' in document.body.style) ? false : true;

?

Edit: or better yet

var roundCorners = !(('MozOpacity' in document.body.style) || ('WebkitOpacity' in document.body.style));



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum