Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#17413 new defect (bug)

Code added by WP_List_Table::_js_vars is duplicated

Reported by: sorich87 Owned by: sorich87
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.2
Component: Administration Keywords: dev-feedback has-patch
Focuses: Cc:


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)

17413.diff (894 bytes) - added by sorich87 3 years ago.
17413.2.diff (1.2 KB) - added by sorich87 3 years ago.
Forgot global in previous patch

Download all attachments as: .zip

Change History (6)

comment:1 solarissmoke3 years ago

  • Keywords dev-feedback added

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_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.

sorich873 years ago

comment:2 sorich873 years ago

  • Keywords has-patch added; needs-patch removed

Attached patch fixes the issue but I am not sure if it breaks something else.

sorich873 years ago

Forgot global in previous patch

comment:3 scribu3 years ago

The idea was that at most one list table was ajax-enabled at a time.

comment:4 Anton Torvald2 years ago

download ebook system game ebook readers game facebook twilight

Version 0, edited 2 years ago by Anton Torvald (next)
Note: See TracTickets for help on using tickets.