WordPress.org

Make WordPress Core

Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#39246 closed defect (bug) (fixed)

Theme deletion has a JS error that prevents multiple themes from being deleted.

Reported by: Hristo Sg Owned by: obenland
Milestone: 4.7.1 Priority: normal
Severity: normal Version: 4.6
Component: Themes Keywords:
Focuses: javascript Cc:

Description (last modified by obenland)

In order to recreate the problem:

  • install multiple themes
  • delete a theme and close the window
  • try deleting a second one - it fails

on the first deletion, I see a JS error in the console:
Error: Syntax error, unrecognized expression: [data-slug="twentyfifteen"

In the wp-admin/js/theme.js there is a line:

$( '[data-slug="' + response.slug + '"' ).css( { backgroundColor:'#faafaa' } ).fadeOut( 350, function() {

in which I believe the shortcode is not closed and should be

$( '[data-slug="' + response.slug + '"]' ).css( { backgroundColor:'#faafaa' } ).fadeOut( 350, function() {

I was testing on Safari Version 10.0.1 (12602.2.14.0.7)

Change History (8)

#1 follow-up: @dd32
12 months ago

  • Milestone changed from Awaiting Review to 4.7.1

Shifting to 4.7.1, confirmed that the bracket is missing.

I see no reason not to fix it here, although curious how it was missed - does the post-fadeout callback function correctly after this is fixed?

This was introduced with [37714] so I'm going to call upon @obenland to test.

(Note: A patch for a single character isn't needed, unless other changes are also needed here, if you test, feel free to skip the patch and just comment with your findings)

Last edited 12 months ago by dd32 (previous) (diff)

#2 @obenland
12 months ago

  • Description modified (diff)
  • Focuses javascript added
  • Owner set to obenland
  • Status changed from new to accepted

#3 in reply to: ↑ 1 @obenland
12 months ago

Replying to dd32:

curious how it was missed - does the post-fadeout callback function correctly after this is fixed?

It works in both Chrome and Firefox, I assume no one then tested it in Safari

#4 @obenland
12 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 39586:

Themes: Add missing square bracket in jQuery selector.

Fixes a bug in Safari where the UI wasn't updated after deleting a theme due to
the incomplete selector.

Props Hristo Sg.
Fixes #39246.

#5 @obenland
12 months ago

In 39587:

Themes: Add missing square bracket in jQuery selector.

Fixes a bug in Safari where the UI wasn't updated after deleting a theme due to
the incomplete selector.

Props Hristo Sg.
Merges [39586] to the 4.7 branch.
Fixes #39246.

#6 @swissspidy
12 months ago

  • Version changed from trunk to 4.6

#7 @Hristo Sg
12 months ago

I have tested it locally and it works without errors in Safari now, just make sure you update the theme.min.js if it's not automatically generated which I doubt though :)

#8 @swissspidy
12 months ago

The minified files are updated during the build process using Grunt.

Note: See TracTickets for help on using tickets.