added code for gradient. use bugTest.html for demo