What is the point of sending HTML, which is in a form that you don't want, to the client browser and making it run JavascriptJavaScript code to clean it up?
This looks like a bad design.
How about fixing all your static HTML, and HTML generation, so that these superfluous <br> elements do not occur in the first place?
If you use JavascriptJavaScript to modify the document object, do so for dynamic effects that cannot be achieved in any other way.