miguel-perez/smoothState.js

storePageIn() fails to find container in new doc if nested

Open

#193 ouverte le 8 juil. 2015

Voir sur GitHub
 (8 commentaires) (0 réactions) (0 assignés)CSS (515 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (4 433 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Nesting the container even one level under the body tag prevents storePageIn() from find it.

<body>
    <div>
        <article id="js-smoothstate-content">
            <h1>TEST CONTENT</h1>
        </article>
    </div>
</body>

The filter() function won't find the container id (Chrome v43):

storePageIn: function (object, url, doc, id) {
    /../
    object[url] = { // Content is indexed by the url
        /../
        html: $newDoc.filter('#' + id), // Stores the contents of the page
    }; 
}

Consider using .find() instead?

Guide contributeur