-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
Description
Summary
The lightbox provider's script enqueuing implementation was causing conflicts with DataTables rendering in certain situations. The issue stemmed from improper script registration/enqueuing patterns and direct HTML output that could interfere with other JavaScript components.
Problem Description
Root Cause
- Improper Enqueuing Pattern: Scripts were being enqueued during registration phase (
wp_enqueue_scriptshook) instead of being registered first and enqueued when needed - Direct Script Output: Using
wp_print_scripts()and manual<script>/<style>tags instead of WordPress's inline script/style APIs - Missing Validation: No checks for whether scripts were already enqueued, leading to potential duplicates
- Timing Issues: Scripts being printed at incorrect times could interfere with DataTables initialization
Impact on DataTables
In some situations, DataTables would fail to render when lightbox scripts were loaded with the following error due to improper script loading order:
[Error] TypeError: undefined is not an object (evaluating 'window.gvDTglobals[i]')
due to potential race conditions between lightbox and DataTables initialization.