Reuse the same document style implementation.

This facilitates customized filters and selectors.

As a bonus removed a couple of deprecated use of JsRegexp