minor improvements and code cleanup for canvas.js
Merge pull request #5446 from CodingFabian/minorImprovementsInCanvasjs

minor improvements and code cleanup for canvas.js