Giter VIP home page Giter VIP logo

Comments (3)

florish avatar florish commented on June 2, 2024 2

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:

assert Parser.parse("a.foo:not([style*=crazy], .bar)") == [

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.

philss avatar philss commented on June 2, 2024 1

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.

philss avatar philss commented on June 2, 2024

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:

defp pseudo_class_match?(html_node, pseudo_class = %{name: "not"}, tree) do

I think the problem may be at the selector parser, around the do_parse_pseudo_not/2 function:

{t, pseudo_not_class} = do_parse_pseudo_not(t, %PseudoClass{name: "not", value: []})

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.