I'm sure that's how the popular html5shim used to work, too. I remember looking at the source out of curiosity.