Skip to content

Commit af2e776

Browse files
committed
Fixed search results display to not assume that only one <tbody> tag would ever exist
1 parent 701134c commit af2e776

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

includes/class-string-locator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static function prepare_full_table( $items, $table_class = array() ) {
368368
}
369369

370370
$table = sprintf(
371-
'<table class="%s" id="string-locator-search-results-table"><thead>%s</thead><tbody>%s</tbody><tfoot>%s</tfoot></table>',
371+
'<table class="%s" id="string-locator-search-results-table"><thead>%s</thead><tbody id="string-locator-search-results-tbody">%s</tbody><tfoot>%s</tfoot></table>',
372372
implode( ' ', $table_class ),
373373
$table_columns,
374374
implode( "\n", $table_rows ),

src/javascript/string-locator-search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ document.addEventListener( 'DOMContentLoaded', function() {
1515
searchRegex = document.getElementById( 'string-locator-regex' ),
1616
tableContainerWrapper = document.getElementById( 'string-locator-search-results-table-wrapper' ),
1717
tableWrapper = document.getElementById( 'string-locator-search-results-table' ),
18-
tableBody = document.getElementsByTagName( 'tbody' )[ 0 ];
18+
tableBody = document.getElementById( 'string-locator-search-results-tbody' );
1919

2020
function addNotice( title, message, format ) {
2121
noticeWrapper.innerHTML += '<div class="notice notice-' + format + ' is-dismissible"><p><strong>' + title + '</strong><br />' + message + '</p></div>';

0 commit comments

Comments
 (0)