Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#23055 closed defect (bug) (fixed)

New Menu Items Add a Mystery 0 below

Reported by: Ipstenu Owned by:
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.6
Component: Menus Keywords: dev-feedback
Focuses: Cc:


Action: Go to add a new item to any menu.

Expected Outcome: New Item is added.

Actual Outcome: New item is added with a 0 below.


This weird 0 vanishes on save, but happens no matter what kind of menu item you try to insert. I can't reproduce this on 3.5, only on Trunk. The 0 shows under each new item until you save.

Attachments (2)

23055.patch (367 bytes) - added by SergeyBiryukov 5 years ago.
23055.2.diff (325 bytes) - added by MikeHansenMe 5 years ago.
original cause of zero.

Download all attachments as: .zip

Change History (16)

#1 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 3.6


#2 @SergeyBiryukov
5 years ago

  • Keywords has-patch added

Introduced along with jQuery 1.9 Beta 1 in [23180].

23055.patch appears to fix this.

5 years ago

original cause of zero.

#3 @MikeHansenMe
5 years ago

  • Cc mdhansen@… added

I think Sergey's patch may be more appropriate but wanted to point out the cause and provide an alternative. The die( 0 ); in admin-ajax.php may be used by other requests but I am not sure.

#4 @nacin
5 years ago

In 23293:

Ensure we wp_die() at the end of an ajax action. see #23055.

#5 @aaroncampbell
5 years ago

  • Keywords close added; has-patch removed

[23293] fixed it for me. Is there a reason this is still open?

#6 @nacin
5 years ago

  • Keywords close removed

I'd like to learn what changed in jQuery 1.9 to cause this 0 to suddenly appear.

#7 @kadamwhite
5 years ago

  • Cc kadamwhite added

#8 @csixty4
5 years ago

  • Cc dave@… added

Not a 1.9 issue per se. Narrowed it down to jquery-migrate.js. Without jquery-migrate, this returns the same results in jQuery 1.8.3 and 1.9.1:

> jQuery('<li>test</li>0')

but when jquery-migrate is loaded, 1.9.1 returns:

> jQuery('<li>test</li>0')
[<li>​test​</li>​, "0"]

#9 @csixty4
5 years ago

Opened a ticket with jquery-migrate detailing what's going on and how it's different from what's happening inside vanilla jQuery: https://github.com/jquery/jquery-migrate/issues/27

#10 @DrewAPicture
5 years ago

  • Keywords needs-patch added

We need to get a fix or a workaround for this in current trunk.

Edit: Cancel that. I think it was an incompatible plugin I was testing on the menus accordion on #23450.

Last edited 5 years ago by DrewAPicture (previous) (diff)

#11 @DrewAPicture
5 years ago

  • Keywords needs-patch removed

#12 @csixty4
5 years ago

I imagine at least a few plugins that die(0) are going to start having problems. Not much core can do about that except get the word out.

#13 @csixty4
5 years ago

  • Keywords dev-feedback added

The jquery-migrate team committed a patch to strip out leading & trailing text outside tags in a string. Also adds the warning "$(html) HTML string has stray text after last tag" and test cases.


Issue is closed on their end. jquery-migrate should probably be upgraded in WP.

#14 @nacin
5 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.