, nodeIndex: array} */ public static function plan($html) { // CRITICAL: Remove speculationrules script tags completely before DOM processing // These contain JSON that DOMDocument corrupts when parsing/saving // Since prefetch/prerender rules should never be translated anyway, removing is safe $html = preg_replace('/]*>[\s\S]*?<\/script>/i', '', $html); // Extract and preserve other script/style tags to prevent DOMDocument from corrupting them $placeholders = []; $placeholder_counter = 0; // Extract