Improve treatment of jQuery as "special citizen" #71

Closed
PatTheMav opened this Issue Oct 31, 2016 · 1 comment

Projects

None yet

2 participants

@PatTheMav
PatTheMav commented Oct 31, 2016 edited

Hey @futtta - we all know and love how jQuery needs to stay in the header to stay compatible with plugins, templates, etc.

Seeing that the optimised CSS and JS use deferred loading by default, I suggest recognising the special role jquery has by giving it it's own setting, e.g.:

  • Enable deferred jQuery in header, or
  • Exclude jQuery from Autoptimize and make it deferred instead

Which (if enabled) excludes it, but instead sets the "defer" attribute when found in the page.

I'm kind of hesitant on installing yet another plugin just to make one script deferred if Autoptimize is handling everything else without issue.

EDIT: Nevermind - upon further testing I haven't been able to make even a deferred jQuery behave properly with some Jetpack modules (InfiniteScroll adds inline code depending on jQuery being loaded without Autoptimize being able to grab it even with enabled aggregation of inline JS).

Consider this issue "invalid".

@PatTheMav PatTheMav closed this Oct 31, 2016
@futtta
Owner
futtta commented Nov 1, 2016

indeed; asyncing jquery would indeed break lots of inline JS that requires jquery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment