HTML tree generator

Could you push this to the spec since it's the one that depends on it?