-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Floki.find doesn't support escaped colons in class names #411
Comments
I tried adding a escaped colon to this in a way that it doesn't conflict with pseudo-selectors but with no success so far https://github.com/philss/floki/blob/master/src/floki_selector_lexer.xrl#L3 |
Hi @fakenickels 👋 I don't know yet how to solve on the lexer/parser level, but there is a way that works today: you can create a html = """
<!doctype html>
<html><head><title>foo</title></head>
<body>
<h1>Hello world</h1>
<div class="container">
<a class="xs:red-500" href="https://example.com">My link</a>
</div>
</body>
</html>
"""
doc = Floki.parse_document!(html)
selector = %Floki.Selector{type: "a", classes: ["xs:red-500"]}
Floki.find(doc, selector)
#=> [{"a", [{"class", "xs:red-500"}, {"href", "https://example.com"}], ["My link"]}] This is not ideal, but at least solve the problem for now. I will try to check this next week. |
hey @fakenickels, would you mind to test the change introduced in #458? |
Description
Floki doesn't support selectors with escaped colons in them, probably it's mixing them up with pseudo selectors
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The current workaround is to use
a[class="xs:red-500"]
The text was updated successfully, but these errors were encountered: