onopko
3/19/2018 - 8:21 AM

Auto will-change for $.fn.html

Auto will-change for $.fn.html

/* ==================================================================
 *
 * Auto will-change for $.fn.html
 *
 * ------------------------------------------------------------------
 *
 * Takehiko Ono (aguije inc.)
 * http://onotakehiko.com/
 *
 * ------------------------------------------------------------------ */

$(function() {

	if ($.fn.html) {
		var originalHtml = $.fn.html;

		$.fn.html = function () {
			$(this).css({ willChange: 'contents' });

			var result = originalHtml.apply(this, arguments);

			$(this).css({ willChange: 'auto' });

			return result;
		}
	}

});