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

Different result about ":last" comparing jquery #167

Open
kiddx01 opened this issue Apr 23, 2017 · 1 comment
Open

Different result about ":last" comparing jquery #167

kiddx01 opened this issue Apr 23, 2017 · 1 comment

Comments

@kiddx01
Copy link

kiddx01 commented Apr 23, 2017

html code here:

<!DOCTYPE html>
<html>
<head>
    <style>.highlight {
        background-color: yellow
    }</style>
    <script type="text/javascript" src="/jquery/jquery.js"></script>
</head>

<body>
    <p>
        <span>Look:</span>
        <span>This is some text in a paragraph.</span>
        <span>This is a note about it.</span>
    </p>
    <p>
        <span>Look:</span>
        <span>This is some text in a paragraph.</span>
        <span>This is a note about it.</span>
    </p>
    <p>
        <span>Look:</span>
        <span>This is some text in a paragraph.</span>
        <span>This is a note about it.</span>
    </p>
</body>
</html>

jquery

code

<script>$("p span:last").addClass('highlight');</script>

result:
This is a note about it.

code:

<script>$("span:last").addClass('highlight');</script>

a same rsult
This is a note about it.

pyquery

code:

html("p span:last").text()
#  'This is a note about it. This is a note about it. This is a note about it.'

html("span:last").text()
#  'This is a note about it.'

why the behavior of pyquery is different with jquery ?
pyquery version: 1.2.17

@gawel
Copy link
Owner

gawel commented Oct 21, 2017

because pyquery is not jQuery. It's hard to get the exact same behavior. Feel free to try to fix this one... :)

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