-
-
Notifications
You must be signed in to change notification settings - Fork 225
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 selectors only match the first found element #215
Comments
Yeah, this was looking weird to me too, when I realized how it works. I may have to revisit that part of the code to fix that. Is there any particular reason to use For now it might require external preprocessing of the document. |
Yeah, sorry my example wasn't complete in that regard. I have other div elements that should not be converted to text, which is why I was looking for a way to cherry pick only some elements. I didn't realize I could build a custom formatter for this. That might be the easiest quick fix. Preprocessing the document sounds somewhat fragile in my use case. Thanks for the tip! If you do choose to revisit that part of the code, one option might be to replace that custom recursive function with |
Current behavior:
Possible alternatives:
I think the first one is more straightforward but with some possibility of a performance drop when looking for extra occurrences when only one is needed. But the other ones might be a bit too complicated fwiw. Although there was a proposal to provide the limit for the number of picked bases too - it didn't make sense before but might make sense now... domutils implementation looks inside matched nodes. My other concern about it is that I'm considering to swap the |
Current behavior allows to manipulate the order of matched elements in the output. Possible solutions:
More careful consideration is needed. I think I will not touch this part for now. In the long run I want multiple existing problems to be solvable with built-in formatters and this falls into a larger task of figuring out the set of good building blocks. |
I think I came up with a reasonable solution while integrating new selectors support. I've pushed new code into a separate branch - selectors I'd be grateful if you can test this version on real tasks and provide your feedback before release (in a week probably). |
Version 8 in now live. |
Minimal HTML example
Options
Observed output
Expected output
Version information
I realize that this may be intended behavior, but it just threw me off, because usually the same class is used in several tags when building HTML. Also there doesn't seem to be an easy way to circumvent this problem, since in my use case the code is generated, so I can't just change the div elements to table elements and use the
tables
attribute.The text was updated successfully, but these errors were encountered: