Pjax icon indicating copy to clipboard operation
Pjax copied to clipboard

Pjax fails when dealing with meta tags with dynamically added tags.

Open Yahav opened this issue 2 years ago • 4 comments
trafficstars

Describe the bug

Please look at the following: https://github.com/PaperStrike/Pjax/discussions/429

To reproduce

No response

Expected behavior

No response

Environment

- OS:
- Browser:
- Pjax:

Anything else?

No response

Yahav avatar Oct 03 '23 11:10 Yahav

You may try to use more specific selectors like meta[name=foo] or with exclusion like meta:not([name=bar]), or custom switches described in https://github.com/PaperStrike/Pjax/discussions/429#discussioncomment-7175102 . Would these be able to solve your issue?

PaperStrike avatar Oct 03 '23 12:10 PaperStrike

Wouldn't work since i don't have head as a selector, when it is the automatic script execution causes issues . one example is when a script tag is added by another script after the dom switch but before preparePage the it's executed twice which causes all kind of issue. i'm handling all the scripts execution myself with hooks, far more flexible.

I still think that since meta are unique tags they should be handled differently (as i stated at the discussion)

Yahav avatar Oct 03 '23 17:10 Yahav

Wouldn't work since i don't have head as a selector

So why not use a head selector?

PaperStrike avatar Oct 03 '23 19:10 PaperStrike

one example is when a script tag is added by another script after the dom switch but before preparePage the it's executed twice which causes all kind of issue.

Are you adding script tags in the switchesResult hook? What exact scenario is this for? Most of the time these operations should be done in a pjax:success/pjax:complete event callback.

PaperStrike avatar Oct 03 '23 20:10 PaperStrike