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

find() and children() #12

Open
iamajoe opened this issue May 4, 2014 · 1 comment
Open

find() and children() #12

iamajoe opened this issue May 4, 2014 · 1 comment

Comments

@iamajoe
Copy link

iamajoe commented May 4, 2014

Tried to use these two Sizzle methods and didn't work.

Sometimes you don't want to give an absolute path to the element. For example, if you have a list and you want to iterate through all the items and retrieve one value from a specific div inside of each one.

The code i'm using:

$.getPage(function (page) {
    // Iterate over each 'h2 a' elements.
    $('.ti').each(function (index, element, done) {
        this.children('a', function () {
            // this should now be te 'a' inside '.ti'
            done();
        });
    },
    // This method is called after all the items have been iterated over...
    function () {
        $.close();
    });
});
@travist
Copy link
Owner

travist commented Jul 5, 2014

This would probably need to be done manually since 'children' is an iterating function and to create an iterating function outside of a synchronous workflow is difficult (since you have to worry about asynchronous behavior). It may need to be done the same as the each function. https://github.com/travist/jquery.go.js/blob/master/lib/jquery.go.js#L258

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