Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#23055 closed defect (bug) (fixed)

New Menu Items Add a Mystery 0 below

Reported by: ipstenu's profile 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 10 years ago.
23055.2.diff (325 bytes) - added by MikeHansenMe 10 years ago.
original cause of zero.

Download all attachments as: .zip

Change History (16)

#1 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 3.6


#2 @SergeyBiryukov
10 years ago

  • Keywords has-patch added

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

23055.patch appears to fix this.

10 years ago

original cause of zero.

#3 @MikeHansenMe
10 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
10 years ago

In 23293:

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

#5 @aaroncampbell
10 years ago

  • Keywords close added; has-patch removed

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

#6 @nacin
10 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
9 years ago

  • Cc kadamwhite added

#8 @csixty4
9 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
9 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:

#10 @DrewAPicture
9 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 9 years ago by DrewAPicture (previous) (diff)

#11 @DrewAPicture
9 years ago

  • Keywords needs-patch removed

#12 @csixty4
9 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
9 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
9 years ago

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