Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#13037 closed defect (bug) (fixed)

Nav menu doesn't like when item is a child of itself

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: ryan's profile ryan
Milestone: 3.0 Priority: high
Severity: normal Version: 3.0
Component: Menus Keywords:
Focuses: Cc:

Description (last modified by dd32)

Page - About
----Category - Uncategorized
--------Page - About

Save Menu

Fatal error: Maximum function nesting level of '100' reached, aborting! in (...) on line 147

Attachments (4)

2010-04-17_0539.png (19.7 KB) - added by johnjamesjacoby 15 years ago.
Curse you wiki formatting!
2010-04-17_0540.png (39.5 KB) - added by johnjamesjacoby 15 years ago.
Which leads to…
13037.diff (2.0 KB) - added by duck_ 15 years ago.
13037.2.diff (2.3 KB) - added by duck_ 15 years ago.
update accounts for items with same id but different types

Download all attachments as: .zip

Change History (11)

#1 @johnjamesjacoby
15 years ago

Damn wiki formatting

Page - About
...Category - Uncategorized
......Page - About

@johnjamesjacoby
15 years ago

Curse you wiki formatting!

@johnjamesjacoby
15 years ago

Which leads to...

#2 @dd32
15 years ago

for reference: to post code & formatted text, wrap it in 3 brackets like this: (Thats wrapped in brackets to show it)

 {{{
  ...the code here...
 }}}

#3 @dd32
15 years ago

  • Description modified (diff)
  • Milestone changed from Unassigned to 3.0

#4 @duck_
15 years ago

  • Keywords has-patch needs-testing added

Patch extends current JavaScript for blocking this from happening (does not solve the underlying problem which would exist for non-js version of menus). Might not be the most optimised method for doing this, if this is the case it still serves as an example (especially since the nav menu feature is currently changing).

@duck_
15 years ago

@duck_
15 years ago

update accounts for items with same id but different types

#5 @duck_
15 years ago

  • Keywords needs-patch added; has-patch needs-testing removed

This bug has changed since filosofo's major update was applied:

Now if you try to make a post/page/whatever a child of itself in a menu you encounter a JavaScript error any time you try to load the menus page, causing only half of the page to render. Steps:

  • Create a menu
  • Add the same post to menu twice
  • Make post child of itself
  • Click save

The error which occurs:
Uncaught TypeError: Object #<an Object> has no method 'autocomplete', line 312 of nav-menu.dev.js

Using console.log(el) before this call I get the quick-search-posttype-post input element, this suggests this is the element throwing the error.

Not had much chance to look into this, busy with exams :-(, but seems like there a no checks in place to stop menu elements being children of themselves.

#6 @duck_
15 years ago

The same problem is also encountered when trying to set an item as the child of another item but has the same ID (i.e. the same menu-item-object-id). An example of this is with Hello World post (id = 1) and Uncategorized (id = 1).

Side note: issues also crop up with clashing IDs when you try to make a third item (say the About page) a child of the clashing item further down the menu:

Start with:

- About
- Hello World
- Uncategorized

Move About to child of Uncategorized:

- Hello World
- Uncategorized
---- About

Save, and you end up with:

- Hello World
---- About
- Uncategorized

#7 @duck_
15 years ago

  • Keywords needs-patch removed
  • Resolution set to fixed
  • Status changed from new to closed

See [14450] and #13249

Note: See TracTickets for help on using tickets.