Iterators unwrapping internal elements

Issue #47 wontfix
created an issue

in pyQuery just like in jQuery all iterators hand the internal objects as the argument to all iterators.

This leads to the paradoxical situation (just like in jQuery) that in the vast majority of cases you have to rewrap the argument to do something useful with it.

I know that the jQuery guys would love to change that decision, but it's too late for them to change that api.

You however still can I would venture to guess.

The old behavior is still easily available by the [0] syntax.

Another reason why this is problematic: you can set specific options on how to parse the content on pyQuery, like parser="xml" or your own css to xpath converter. However whenever you rewrap a subtree you have to make sure that you hand in those options again, which can easily be missed. (And caused me several hours of bug fixing un-quality time).

Comments (1)

  1. Gael Pasgrimaud

    We want to follow jQuery behavior. And this change will break everybody code. So, I'm kind of agree. But we can't do that.

    Except if you find a clever solution. But I can't find one.

  2. Log in to comment