jQuery.htmlPrefilter()


jQuery.htmlPrefilter( html )Returns: String

Description: Modify and filter HTML strings passed through jQuery manipulation methods.

This method rarely needs to be called directly. Instead, use it as an entry point to modify existing jQuery manipulation methods. jQuery calls this method on input HTML before processing it further: it accepts an HTML string & should return a HTML string as well.

This function can also be overwritten in order to bypass certain edge case issues. The default htmlPrefilter function in jQuery leaves input unmodified since 3.5.0. Older versions would greedily ensure that all tags were XHTML-compliant. This included anything that looked like an HTML tag, but was actually within a string (e.g. <a title="<div />"><>), leading to potential security issues. For more information, see the jQuery Core 3.5 Upgrade guide.