Hm... yeah, let's require it to be a string. And yes, let's pull it out of the function so it can be precompiled.

I think `/^ /g` is correct. We want to replace the leading space with `&nbsp;` so that the remaining whitespace characters are preserved. For example:

```html
<pre>  2-space indentation</pre>
```

Replacing the first whitespace with `&nbsp;` should give us similar behavior in IE8- as what we'd expect. If we replace all of the leading whitespace characters, we would lose the second character.