Adding passive listeners to jQuery

Issue

  • When running audit with Google Pagespeed is common to find a recommendation about implementing passive listeners for jQuery. How can we do this?

Environment

  • Liferay DXP (any version)

Resolution

  • Since jQuery is deprecated, and actually is disabled by default since Liferay DXP 7.3, we are not planning to add any new functionality to it, so this must be achieved through a custom development. To do so, we recommend you to use an extension point like /html/common/themes/top_head.jsp#post DynamicInclude.
  • In order to know more about how to use DynamicInclude extension points in Liferay we recommend you to read the article Top Head JSP Dynamic Includes.
  • In order to know which code to add to this specific case, we recommend you to have a look at the attached file MyDynamicIncludeJQuery.java. Consider this file as a reference rather than as a final solution since it might get outdated or it might need some small adjustments depending on the version.

 

Additional Information

 

¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0