estrattonbailey / operator

1.8kb drop-in "PJAX" solution for fluid, smooth transitions between pages.
90 stars 11 forks source link

Fall back to full page load if new url doesn't have root element #19

Open scottsb opened 4 years ago

scottsb commented 4 years ago

Ideally URLs that point to pages on the site without a shared root element would be labeled with the no-ajax class and thus not trigger the PJAX behavior. However, sometimes this is missed, and before this PR, these links would simply fail to load (clicking would do nothing). This change allows the load to proceed as a full-page load. It's wasteful because it still triggers the XHR load in between, but at least the site does not break. (Using no-ajax is still the right solution to avoid this waste--this is intended only as a failsafe.)