Opened 2 years ago
Last modified 19 months ago
#17413 new defect (bug)
Code added by WP_List_Table::_js_vars is duplicated
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Administration | Version: | 3.2 |
| Severity: | normal | Keywords: | dev-feedback has-patch |
| Cc: |
Description
When a list table is 'ajax enabled' (e.g. comments list table on edit-comments.php), javascript code is added by WP_List_Table::_js_vars to the footer. If you look at the source code in your browser, you will see that code is duplicated.
Attachments (2)
Change History (6)
comment:1
solarissmoke — 2 years ago
- Keywords dev-feedback added
- Keywords has-patch added; needs-patch removed
Attached patch fixes the issue but I am not sure if it breaks something else.
comment:4
Anton Torvald — 19 months ago
Nothing.
Note: See
TracTickets for help on using
tickets.

The problem is that two instances of the List_Table class are created while loading the page, and each time the constructor hooks $this->_js_vars to admin_footer. In the case of edit-comments.php:
wp-admin/edit-comments.php:14
$wp_list_table = _get_list_table('WP_Comments_List_Table');and then again in wp-admin/includes/template.php:337
$wp_list_table = _get_list_table('WP_Comments_List_Table');I wonder if there isn't a fundamental problem here in that we are creating multiple list tables instances when we should be using only one. Certainly the current js stuff assumes there is only one list table.