Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS whiteSpace removes the whole script #419

Open
mitsh opened this issue Jan 25, 2024 · 0 comments
Open

JS whiteSpace removes the whole script #419

mitsh opened this issue Jan 25, 2024 · 0 comments

Comments

@mitsh
Copy link

mitsh commented Jan 25, 2024

latest version of the minify js, removes all the datatables script on the step of whiteSpace cleaning.

I track down the script line by line, found the for-loop part that removes all the content.

$content = preg_replace('/(for\((?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*);[^;\{]*;[^;\{]*\));(\}|$)/s', '\\1;;\\4', $content);

I just modified the line to prevent the script being emptied.

$old_content = $content;
        $content = preg_replace('/(for\((?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*);[^;\{]*;[^;\{]*\));(\}|$)/s', '\\1;;\\4', $content);
		if (empty($content))
		{
			$content = $old_content;
		}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant