refactoring.  split out dom-helper