First up, using Javascript to add invalid attributes to elements is exactly as bad as putting them in the HTML in the first instance. You're just masking the "problem".
Second, I said this in another answer but the key to good validation is knowing what are the important errors to tackle. Will adding target="_blank"
to a link negatively affect someone using a particular browser? No - either the link will open in a new window, or it won't. It won't break the layout or crash their browser or anything.
A strict doctype* is the only sensible choice for new web pages, because it massively reduces cross-browser problems, moreso than any other technique. But using a strict doctype doesn't mean your code must be 100% valid to the spec. It's okay to use technically invalid attributes as long as you are aware of the consequences (or lack of) when a browser might not support a feature.
* Personally I love the HTML5 doctype: <!DOCTYPE html>
.
Incredibly easy to remember and it forces strict mode in all browsers, even IE6.