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

Wrong handling of file type in <PRELOAD> #3

Open
visualstation opened this issue Sep 13, 2016 · 1 comment
Open

Wrong handling of file type in <PRELOAD> #3

visualstation opened this issue Sep 13, 2016 · 1 comment

Comments

@visualstation
Copy link

In action.php,

the value of $entrytype is css or js.
But in the switch/case, it's .css or .js.

But by default you are considering that everything is javascript, you could not see that the switch case was wrong.

foreach ($items as $entry) { // check file name extention $entrytype = pathinfo($entry, PATHINFO_EXTENSION); switch ($entrytype) { case "css": $event->data['link'][] = array( 'rel' => 'stylesheet', 'type' => 'text/css', 'href' => $entry, ); break; case "js": $event->data['script'][] = array( 'type' => 'text/javascript', 'charset' => 'utf-8', 'src' => $entry, '_data' => '', ); break; default: break; } }

Thus, the case default should be empty to avoid bad handling.

@ssahara
Copy link
Owner

ssahara commented Sep 15, 2016

@visualstation
Thanks for your reviewing the code. I agree your idea that non .js file should not preloaded.
Could you make push request to fix this issue? I really want record your contribution in the repo.
Please tell me if you have any difficulty to do so.

Best regards,
Satoshi

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

2 participants