• The Xinha WYSIWYG Editor, HTMLPurifier and the non-validating br tags.
    09/23/2009 1:41PM

    So I just spent some time tracking down a little bug which turned out to be my own stupid fault. 

    formVista uses HTMLPurifier to sanitize HTML that's submitted by end users. HTMLPurifier rocks. 

    However, Ryan over at Nuts and Bolts Interactive discovered <br /> tags submitted using the WYSIWYG html editor are changed to <br>. This is not correct for the XHTML 1.0 Transitional doctype that we're using on the front end.

    After some digging, I realized that I had set the doctype correctly on the frontend but had set it to HTML 4.01 Transitional on the backend. (We still have a lot of work to do bringing the backend out of the stone-age).

    Since HTMLPurifier was being loaded on the backend it was getting the backend's doctype and doing exactly what it was supposed to do.

    So the takeway is, if HTMLPurifier is not doing what you expect it to be doing, make sure to check that you are in fact passing it the correct doctype.