jQuery 1.9 doesn't like leading whitespace from wp_ajax_add_menu_item
|Reported by:||csixty4||Owned by:||ocean90|
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 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).
Change History (15)
- Keywords 3.7-early added
- Milestone changed from 3.6 to Future Release