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

has not support eq(index) string in filter selector? #139

Open
jjwt opened this issue Jun 23, 2016 · 2 comments
Open

has not support eq(index) string in filter selector? #139

jjwt opened this issue Jun 23, 2016 · 2 comments

Comments

@jjwt
Copy link

jjwt commented Jun 23, 2016

it is found that .eq(index) selector works well as a outer selctor ,but not in filter string.
Below is test function

def test_a():
    s = '''
    <html>
        <div id='ip_list'>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
                <td>6</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
                <td>6</td>
            </tr>
        </div>
    <html>
    '''
    from pyquery import PyQuery as pq
    print()
    print(pq(s)('#ip_list tr').eq(0))  # works fine
    print(pq(s)('#ip_list tr').filter(':eq(0)')) #does not work
    print(pq(s)('#ip_list tr').filter(':eq(0), :eq(1)')) #does not work either
@ayiis
Copy link

ayiis commented Aug 23, 2019

I love to use pyquery to do html work, I have the same question, and it's still not working now.

@gawel
Copy link
Owner

gawel commented Aug 23, 2019

Maybe the translation isn't correct https://github.com/gawel/pyquery/blob/master/pyquery/cssselectpatch.py#L367

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

3 participants