Use DOMContentLoaded (should help with #815).