They don't encapsulate initialization code in dom ready event In their official samples like this开发者_运维百科(click view source).
Is it safe to use it without dom ready event ? It controls dom ready event inside of initialization ?
This is no problem, because you can wrap inside a document ready block. That's what i do using tinymce. What they have on their page is just a simple example.
On Dom Ready is something that was --mostly-- developed for a certain browser that doesn't follow the "rules" (in case you're wondering, it starts with an I and ends with an E) Dom ready helps with other things as well, but bottom line is that you can most often get away without it, especially since IE6 is finally on its way out.
Try it out, test widely as you should be doing anyway, and if you're happy with the results, run with it. This is one of the things that there's no set standard for. Quite a bit of my company's legacy Javascript (including several instances of Tiny that are about to be deprecated) has been running in production without dom listeners for 2+ years without issue.
精彩评论