[wp-trac] [WordPress Trac] #23681: jQuery 1.9 doesn't like leading whitespace from wp_ajax_add_menu_item
WordPress Trac
noreply at wordpress.org
Mon Mar 4 03:27:30 UTC 2013
#23681: jQuery 1.9 doesn't like leading whitespace from wp_ajax_add_menu_item
-----------------------------+--------------------------
Reporter: csixty4 | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Menus
Version: trunk | Severity: normal
Keywords: has-patch |
-----------------------------+--------------------------
jquery-migrate logs this message to the console when adding a new menu
item:
{{{
JQMIGRATE: $(html) HTML strings must start with '<' character
}}}
Walker_Nav_Menu_Edit returns a <li> indented with two tabs because there's
inline HTML in that class and it's indented. jQuery 1.9 rejects HTML
strings with leading whitespace [http://blog.jquery.com/2013/01/31/jquery-
migrate-1-1-0-released/ for security reasons].
(Note: this is probably why jquery-migrate is calling parseHTML instead of
using a regex in #23055)
This patch uses $.parseHTML on the HTML fragment instead of passing it
directly to $(). As it's written, $.parseHTML will strip out any scripts
in the fragment for security reasons. If you think a plugin might include
a script for some reason, the call should be changed to
$.parseHTML(menuMarkup, document, true).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23681>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list