You can't move this code into init() without moving a bunch of other initialization code as well.  But if you remove the unit test, as I suggest, then you don't have to move it.  Search for "dom.*" in top-level code to find places where this code is expected to be run before init().