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: sorich87 Owned by: sorich87
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)

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

Download all attachments as: .zip

Change History (6)

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

  • Keywords has-patch added; needs-patch removed

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

Forgot global in previous patch

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

download ebook system game ebook readers game facebook twilight

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