WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #27848, comment 5


Ignore:
Timestamp:
04/17/2014 05:00:19 AM (6 years ago)
Author:
rzen
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27848, comment 5

    initial v1  
    55During `api.HeaderControl.ready()`, on [https://core.trac.wordpress.org/browser/tags/3.9/src/wp-admin/js/customize-controls.js#L322 lines 322-325 of customize-controls.js], we instantiate a new `api.HeaderTool.CurrentView`.
    66
    7 Inside of `api.HeaderTool.CurrentView` is a method called `setButtons()`, seen on [https://core.trac.wordpress.org/browser/tags/3.9/src/wp-admin/js/customize-views.js#L72 line 72 of customize-views.js]. This gets called during render, which is called when the moment the view is instantiated in `api.HeaderControl.ready()`.
     7Inside of `api.HeaderTool.CurrentView` is a method called `setButtons()`, seen on [https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/js/customize-views.js#L72 line 72 of customize-views.js]. This gets called during render, which is called when the moment the view is instantiated in `api.HeaderControl.ready()`.
    88
    99The sole purpose `api.HeaderTool.CurrentView.setButtons()` is to determine whether or not `.actions .remove` should be shown or hidden based on the current view.
    1010
    11 The issue here is that `setButtons()` is targeting ''any'' matching elements via`$('.actions .remove')` and instead the selector should be limited to the view's scope (e.g. `this.$el.find('.actions .remove')`). I know that fixes the problem, anyway, but I'm not sure what other problems it may create.
     11The issue here is that `setButtons()` is targeting ''any'' matching elements via`$('.actions .remove')` on [https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/js/customize-views.js#L73 line 73 of customize-views.js]. Instead, the selector should be limited to the view's scope (e.g. `this.$el.find('.actions .remove')`). I know that fixes ''this'' problem, anyway, but I'm not sure what other problems it may create. :)
    1212
    1313I'm going to dig in a bit more.