Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery errors in Chrome console #171

Open
mlpatt23 opened this issue Sep 4, 2019 · 1 comment
Open

jQuery errors in Chrome console #171

mlpatt23 opened this issue Sep 4, 2019 · 1 comment

Comments

@mlpatt23
Copy link
Contributor

mlpatt23 commented Sep 4, 2019

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

@erwstout
Copy link
Member

erwstout commented Sep 5, 2019

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

image
image

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

No branches or pull requests

2 participants