Comments (3)
Hi @philss! Thanks for the quick and detailed response.
After a quick look into the linked code, my conclusion for now is that "I also can handle this later this week" is indeed what I prefer 😄. I'm afraid it'll take me longer than that before I have the time to get this fixed.
This being said, I think I've pinpointed the exact test assertion that should be changed:
floki/test/floki/selector/parser_test.exs
Line 311 in 57c07e0
This test is asserting the return value for Parser.parse("a.foo:not([style*=crazy], .bar)")
and currently (wrongly!) expects the value to be a list that only contains a %Selector{}
for type: "a"
. In reality, there should also be a second selector matching .bar
.
I'm not entirely sure what this .bar
%Selector{}
should contain, but I hope this saves you some research time.
Thanks again for getting back so quickly, greatly appreciated!
from floki.
This test is asserting the return value for
Parser.parse("a.foo:not([style*=crazy], .bar)")
and currently (wrongly!) expects the value to be a list that only contains a %Selector{} for type: "a". In reality, there should also be a second selector matching .bar.
In this case, the second selector is going to be inside the "not" pseudo-class - we should have two selectors inside this pseudo-class, and one outside.
@florish thanks for the tips and for opening the issue! 💜
I should release a new version soon.
from floki.
Hey @florish 👋
Thanks for open the issue!
Yeah, this is really strange. For some reason the parsing of the :not
pseudo-class is also including the hr
.
You can observe that by inspecting the value of pseudo_class
here:
Line 197 in 57c07e0
I think the problem may be at the selector parser, around the do_parse_pseudo_not/2
function:
floki/lib/floki/selector/parser.ex
Line 71 in 57c07e0
There are tests for this module in here: https://github.com/philss/floki/blob/57c07e00d0983928546de0853d007e16827fbe8d/test/floki/selector/parser_test.exs
Please let me know if you need more guidance. (I also can handle this later this week if you prefer).
from floki.
Related Issues (20)
- Floki using the built in parser does not handle the optional closing p tag HOT 5
- html_declaration can be a 2 tuple HOT 1
- Suggestion self_closing_tags HOT 5
- Floki.find doesn't support escaped colons in class names HOT 3
- parse_fragment does not parse whitespace in HTML (or XML) text properly
- traverse_and_update/3 return typespec needs html_tree() HOT 4
- Unhandled error for Floki.parse_fragment/2 HOT 1
- CDATA inside a title tag is not handled in Mochiweb parser
- Is there a way to replace paragraph tags by newlines in Floki.text()? HOT 1
- Proposal: Add Floki.Doc HOT 10
- Drop support for Elixir 1.11
- Allow option to parse attributes as maps HOT 9
- Floki is extremely noisy in logs
- Support for :has pseudo selector
- Error after upgrading to 0.35.0 HOT 6
- Buttons in Header Section Lacks Transition!!
- Floki attribute example is ambiguous
- Proposal: optimized find for simple cases HOT 6
- Is it possible to get line/column number of a tag? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from floki.