MoOx / pjax

Easily enable fast Ajax navigation on any website (using pushState + xhr)
MIT License
1.43k stars 124 forks source link

adding title to selectors results in full page loading #231

Closed BigGitWorld closed 3 years ago

BigGitWorld commented 3 years ago

This is my simple pjax code:

 var pjax = new Pjax({
        selectors: [
            "title",
            "#content-main"
        ]
    });

If title does not exist in the above code, everything work fine (title of page does not change). But If I add title to the selectors (such as the above), I have a full page loading!

My DOM is same and I can use jquery-pjax lib successfully.

what is the problem?

piperhaywood commented 3 years ago

@BigGitWorld I’m running in to a similar issue and can’t seem to figure out what’s going on, were you able to sort this out?

piperhaywood commented 3 years ago

Just adding a followup: I think the issue may have been an embed on the page, perhaps Pjax is detecting multiple titles? At any rate, I added a class to the <title> tag like so: <title class="site-title"> and then used the selector title.site-title in the options and this seemed to clear it up.