[wp-trac] [WordPress Trac] #27355: Customizer: Add framework for selective refresh (partial preview refreshes)

WordPress Trac noreply at wordpress.org
Fri Feb 19 07:21:21 UTC 2016


#27355: Customizer: Add framework for selective refresh (partial preview refreshes)
-------------------------------------------------+-------------------------
 Reporter:  westonruter                          |       Owner:
     Type:  task (blessed)                       |  westonruter
 Priority:  normal                               |      Status:  accepted
Component:  Customize                            |   Milestone:  4.5
 Severity:  normal                               |     Version:  3.4
 Keywords:  has-patch has-unit-tests commit      |  Resolution:
  has-screenshots                                |     Focuses:  javascript
-------------------------------------------------+-------------------------
Changes (by westonruter):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests commit
     has-screenshots
 * status:  reviewing => accepted


Comment:

 Replying to [comment:72 ocean90]:
 > *  Nav Menus: Probably unrelated: Assign an author the
 `edit_theme_options` cap and enter "foo'foo" into the input field for a
 menu item title: For some reasons the preview will have slashes.
 (https://cloudup.com/ccKXry0gjDC)

 I narrowed this down to the following line in
 `WP_Customize_Nav_Menu_Item_Setting::sanitize()`:

 {{{#!php
 <?php
 $menu_item_value['title'] = apply_filters( 'title_save_pre',
 $menu_item_value['title'] );
 }}}

 The the `wp_filter_kses` function is adding the slash which applies on
 this `title_save_pre` filter. For some reason, the function does:

 {{{#!php
 <?php
 return addslashes( wp_kses( stripslashes( $data ), current_filter() ) );
 }}}

 Which is the reason for the slash being injected, because `addslashes()`
 adds slashes before apostrophes, even though there wasn't a slash that got
 stripped originally by `stripslashes`. So, to me this function and
 (`wp_filter_post_kses` like it) looks like it is doing the wrong thing.
 The easiest way I see to fix the issue is to bypass those KSES functions
 altogether with something like [attachment:nav-menu-item-kses-filter-
 fix.diff].

 All of this to say, no, it is not related to the new selective refresh
 functionality being introduced here.

 Adding `commit` keyword, and I'll commit in ~12 hours, unless anything
 else is identified needing to be fixed prior to commit.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27355#comment:80>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list