-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
CSS selector with multiple :not fails #451
Comments
There is any update on this issue? |
We're discussing overhauling CSS selector parsing for the next major release. Nothing is likely to happen very soon, unfortunately. :( |
Ran into this too, subscribing |
I ran into this problem, too. Has there been any progress so far? |
We're targeting overhauling CSS selector parsing for the next major release (i.e., Nokogiri 2.0). Nothing is likely to happen before summer. |
+1 |
👍 I've ran into this today. I ended up working around it using XPATH selectors instead of CSS. |
👍 |
+1 any updates on this? |
I believe this has already been fixed by #887. |
Still not fixed. I used it in the following way: page.css('.someclass tr:not(:nth-child(1)):not(:nth-child(2))') also I tried page.css('.someclass tr:not(:nth-child(1)):nth-child(2)') which not works too page.css('.someclass tr:nth-child(2):not(:nth-child(1))') works logs: for page.css('.someclass tr:not(:nth-child(1)):not(:nth-child(2))') 2014-03-15 17:00:40.490 ERROR: Nokogiri::CSS::SyntaxError: unexpected ':not(' after '[#<Nokogiri::CSS::Node:0x00000000f70a30 @type=:DESCENDANT_SELECTOR, @value=[#<Nokogiri::CSS::Node:0x00000000f72038 @type=:CONDITIONAL_SELECTOR, @value=[#<Nokogiri::CSS::Node:0x00000000f72330 @type=:ELEMENT_NAME, @value=["*"]>, #<Nokogiri::CSS::Node:0x00000000f72880 @type=:CLASS_CONDITION, @value=["someclass"]>]>, #<Nokogiri::CSS::Node:0x00000000f70cd8 @type=:CONDITIONAL_SELECTOR, @value=[#<Nokogiri::CSS::Node:0x00000000f71868 @type=:ELEMENT_NAME, @value=["tr"]>, #<Nokogiri::CSS::Node:0x00000000f70d28 @type=:NOT, @value=[#<Nokogiri::CSS::Node:0x00000000f70f30 @type=:PSEUDO_CLASS, @value=[#<Nokogiri::CSS::Node:0x00000000f712c8 @type=:FUNCTION, @value=["nth-child(", "1"]>]>]>]>]>]' and for page.css('.someclass tr:not(:nth-child(1)):anyselector') 2014-03-15 17:05:07.358 ERROR: Nokogiri::CSS::SyntaxError: unexpected ':' after '[#<Nokogiri::CSS::Node:0x000000012e87a8 @type=:DESCENDANT_SELECTOR, @value=[#<Nokogiri::CSS::Node:0x000000012e99c8 @type=:CONDITIONAL_SELECTOR, @value=[#<Nokogiri::CSS::Node:0x000000012e9a40 @type=:ELEMENT_NAME, @value=["*"]>, #<Nokogiri::CSS::Node:0x000000012e9f18 @type=:CLASS_CONDITION, @value=["someclass"]>]>, #<Nokogiri::CSS::Node:0x000000012e88e8 @type=:CONDITIONAL_SELECTOR, @value=[#<Nokogiri::CSS::Node:0x000000012e9590 @type=:ELEMENT_NAME, @value=["tr"]>, #<Nokogiri::CSS::Node:0x000000012e8960 @type=:NOT, @value=[#<Nokogiri::CSS::Node:0x000000012e8cf8 @type=:PSEUDO_CLASS, @value=[#<Nokogiri::CSS::Node:0x000000012e8de8 @type=:FUNCTION, @value=["nth-child(", "1"]>]>]>]>]>]' |
Yeah, I've patched this already :-( |
After the twitter gem and API have proven to be flawed and unreliable I've decided to remove gut it. I've resorted to screenscraping for tweets. I'm not proud of it, It works, however, and I am losing zero functionality. Though, responce times will be slower since instead of fetching a tiny JSON object the entire web page is being fetched and then parsed with nokogiri. I'm doing some magic with XPATH since, unfortunately, nokogiri did not like me having two nots in my css selectors. Note the relevant ticket: sparklemotion/nokogiri#451
Trying to use the following CSS selector raises an Nokogiri::CSS::SyntaxError exception: *:not(.one):not(.two)
This page from w3.org uses the following similar selector as an example: *:not(.txt_escuro):not(.fotoMateria), so it should be valid.
The text was updated successfully, but these errors were encountered: