Make WordPress Core

Opened 11 years ago

Closed 11 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:

Description

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.

http://f.cl.ly/items/161O072y2K0135191n3F/Screen%20Shot%202012-12-25%20at%20%2025%20Dec%20-%209.18.17%20AM.png

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 11 years ago.
23055.2.diff (325 bytes) - added by MikeHansenMe 11 years ago.
original cause of zero.

Download all attachments as: .zip

Change History (16)

#1 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.6

Confirmed.

#2 @SergeyBiryukov
11 years ago

  • Keywords has-patch added

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

23055.patch appears to fix this.

@MikeHansenMe
11 years ago

original cause of zero.

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

In 23293:

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

#5 @aaroncampbell
11 years ago

  • Keywords close added; has-patch removed

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

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

  • Cc kadamwhite added

#8 @csixty4
11 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')
[<li>​test​</li>​]

but when jquery-migrate is loaded, 1.9.1 returns:

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

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

#11 @DrewAPicture
11 years ago

  • Keywords needs-patch removed

#12 @csixty4
11 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
11 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.

https://github.com/jquery/jquery-migrate/commit/c8147a3ba66cc50a05ae09ffa3d3f3df811f30ae

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

#14 @nacin
11 years ago

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