If you are still stuck, I can have a look. I'm quite the experienced web developer if I may say so and I also created my own HTML5 engine. And from what I can read you struggle with stuff I had to deal with years ago. The issue with creating your own HTML5 engine is that it will work for small games but you'll hit performance limits quite easily. To start, you aren't using WebGL, are you? ;)