Guard tablesaw enhancement: only add markup to tables with header cells

lb_table_preprocess_block__lb_table() sets a #post_render callback that rewrites every

in the block body, unconditionally adding class="tablesaw" and data-tablesaw-mode="swipe".

tablesaw's Table.prototype.init() then throws and aborts:

Uncaught Error: tablesaw: a

is required, but none was found. Uncaught Error: tablesaw: no header cells found. Are you using ?

The throw is uncaught inside Tablesaw.init(), so it also stops the remaining tables on the same page from being enhanced. Tables authored in CKEditor (or pasted from a word processor) routinely have no

, so any such table in an lb_table block breaks tablesaw for the whole page.

Match whole

inside of
...
blocks and only add the tablesaw markup when the table contains a with header cells. Header-less tables are left as plain markup - no JS error, and they still render.

Merge request reports

Loading
Loading