Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with refactoring

    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!)

    Code:
    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

  • #2
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Something like
    Code:
    var roundCorners = ('MozOpacity' in document.body.style) || ('WebkitOpacity' in document.body.style) ? false : true;
    ?

    Edit: or better yet
    Code:
    var roundCorners = !(('MozOpacity' in document.body.style) || ('WebkitOpacity' in document.body.style));
    Last edited by venegal; 05-21-2009 at 12:32 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •