-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add suppport for [of S]
? part in nth-child's arguments
#120
base: master
Are you sure you want to change the base?
Add suppport for [of S]
? part in nth-child's arguments
#120
Conversation
5ac2aa8
to
c416f4b
Compare
i know the tests will be failing, but since i promised to have an update today, here it is :) |
c416f4b
to
2722ae6
Compare
…s_part_in_nth_child
4872d29
to
76b78cd
Compare
Codecov Report
@@ Coverage Diff @@
## master #120 +/- ##
==========================================
- Coverage 96.12% 95.58% -0.55%
==========================================
Files 2 2
Lines 878 929 +51
Branches 153 166 +13
==========================================
+ Hits 844 888 +44
- Misses 18 23 +5
- Partials 16 18 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
97951eb
to
058b6b5
Compare
@annbgn @elacuesta do we still need anything else done here? |
imho no |
[of S]
? part in nth-child's arguments[of S]
? part in nth-child's arguments
cssselect/parser.py
Outdated
@@ -165,14 +165,14 @@ def __repr__(self): | |||
return "%s[::%s(%r)]" % ( | |||
self.__class__.__name__, | |||
self.name, | |||
[token.value for token in self.arguments], | |||
[token.value for token in self.arguments[0]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line rang a bell to me. With no other changes to the class, it means that the arguments
argument is now expected to be formatted differently, which breaks backward compatibility. Consider the following diff:
diff --git cssselect/parser.py cssselect/parser.py
index 4351f07..48e7604 100644
--- cssselect/parser.py
+++ cssselect/parser.py
@@ -160,6 +160,7 @@ class FunctionalPseudoElement(object):
def __init__(self, name, arguments):
self.name = ascii_lower(name)
self.arguments = arguments
+ print("arguments:", arguments)
def __repr__(self):
return "%s[::%s(%r)]" % (
Then at the current master
branch (9edc6c3):
In [1]: from cssselect import parse
In [2]: p = parse("a::asdf(arg1)")
arguments: [<IDENT 'arg1' at 8>]
While at the current add_support_for_of_s_part_in_nth_child
branch (058b6b5):
In [1]: from cssselect import parse
In [2]: p = parse("a::asdf(arg1)")
arguments: ([<IDENT 'arg1' at 8>], None)
Could you explain the rationale of this change? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, the backward compatibility breaks, because I changed signature of method parse_arguments
which is used both for functions and functional pseudo elements.
Now I splitted parsing arguments into separate methods, so nothing will break
Nice catch!
Closes #76.