prelude-wp icon indicating copy to clipboard operation
prelude-wp copied to clipboard

jQuery errors in Chrome console

Open mlpatt23 opened this issue 6 years ago • 1 comments

Chrome is throwing 3 of the same error from this code:

const Bowser = require("bowser");

jQuery(document).ready(function($) {
  // Inside of this function, $() will work as an alias for jQuery()
  // and other libraries also using $ will not be accessible under this shortcut
  // https://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers

  // Touch Device Detection
  var isTouchDevice = "ontouchstart" in document.documentElement;
  if (isTouchDevice) {
    $("body").removeClass("no-touch");
  }

  // Browser detection via Bowser (https://github.com/lancedikson/bowser) - add detection as needed
  const userBrowser = Bowser.getParser(window.navigator.userAgent);
  const browser = userBrowser.getBrowser();

  if (browser.name === "Internet Explorer" && browser.version == "11.0") {
    $("body").addClass("ie-11");
  } else if (browser.name === "Safari") {
    $("body").addClass("safari");
  } else if (browser.name === "Chrome") {
    $("body").addClass("chrome");
  }
});
Screen Shot 2019-09-04 at 1 15 50 PM

Additionally, Chrome's Sources tab isn't showing the theme's js at all:

Screen Shot 2019-09-04 at 1 08 38 PM

mlpatt23 avatar Sep 04 '19 20:09 mlpatt23

It appears I cannot replicate the issue. Can you try a fresh installation with no files brought over from a previous project?

image image

erwstout avatar Sep 05 '19 01:09 erwstout