The most important thing is to make it work, and if the only way to do that in all browsers is to use one invalid tag, then do so and forget about it showing up as invalid. So I'd have stuck with the original bit of code, and check that the rest of the code was valid. If a client complains you just say that is how you make it work in all browsers.
Do all your users visit the page, then immediately run it through a validator, or do they just use it? Validation is important, but it is NOT the be-all-and-end-all of web design.
Remember the code used to make AJAX work, window.XMLHttpRequest, is a manufacture invented bit of code, but no-one complains because it works.