Refactored oj.compile to better support dom creation