Skip to content

jQuery errors in Chrome console #171

Open
@mlpatt23

Description

@mlpatt23

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions