Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Javascript error during page edit after upgrading from WordPress 5.2.4 to 5.3 #297

Closed
logantech opened this issue Nov 24, 2019 · 1 comment

Comments

@logantech
Copy link

logantech commented Nov 24, 2019

After upgrading to WordPress 5.3 from 5.2.4, when editing a page there is now a javascript error in this location:

http://localhost:8080/mysite/wp-content/themes/primer/assets/js/admin/layouts.min.js?ver=1.8.7

layouts.min.js?ver=1.8.7:1 Uncaught TypeError: $ is not a function
at toggleEditorWidth (layouts.min.js?ver=1.8.7:1)
at HTMLDocument. (layouts.min.js?ver=1.8.7:1)
at HTMLDocument.dispatch (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.3:3)
at HTMLDocument.r.handle (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.3:3)
at Object.trigger (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.3:3)
at Object.a.event.trigger (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.3:8)
at a.fn.init.triggerHandler (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.3:3)
at Function.ready (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.3:2)
at HTMLDocument.J (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.3:2)

The error does not occur under WordPress 5.2.4.

The error happens in this function, looks like jQuery is not making into the function scope, $(“body.gutenberg-editor-page”) is not instantiated:

function toggleEditorWidth(e){e=0<=e.indexOf(“wide”)?”wide”:0<=e.indexOf(“narrow”)||0<=e.indexOf(“three-column”)?”narrow”:”default”,$(“body.gutenberg-editor-page”).removeClass(“primer-gutenberg-default primer-gutenberg-wide primer-gutenberg-narrow”).addClass(“primer-gutenberg-“+e)}window.wp=window.wp||{},function(e){e(document).ready(function(){e(‘input[name=”primer-layout-override”]’).change(function(){“1”!==e(this).val()?(e(“.primer-layout ul li”).addClass(“disabled”).find(“:not(.global)”).removeClass(“active”).addClass(“disabled”).find(“input”).prop(“disabled”,!0),e(“.primer-layout ul li.global input”).prop(“checked”,!0).trigger(“change”)):e(“.primer-layout ul li”).removeClass(“disabled”).addClass(“active”).find(“input”).prop(“disabled”,!1)}),e(‘input[name=”primer-layout”]’).change(function(){toggleEditorWidth(e(this).val())})}),e(document).on(“ready”,function(){toggleEditorWidth(primerLayouts.selected)})}(jQuery);

To reproduce:

  1. Log into your WordPress 5.3 site
  2. Pick a page
  3. Click to edit the page
  4. In JavaScript console you'll see the error thrown
@aledesma-godaddy
Copy link

Closing issues and PRs in preparation for repository archival

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

No branches or pull requests

2 participants