fix for quoted attributes returning "§" (#26) #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that when the regex for finding the strings ran, it was not actually finding the entirety of the string (it was grabbing the last character or two). I altered the regex to make the entire string within the quote be selected by making the original
content
variable a non-capturing group and making the repeated group the variable instead.Doing this seems to fix all the issues where I saw the "§" value appear after tokenization. I manually tested this using any of the examples mentioned in the issue or the other PR attempting a fix:
footprint[uid="ca135f26-2b55-db63-7451-5a8effb2a19f"] > pad[uid="100a8763-0d5f-de60-23a5-00d74f3ecad7"]
[data-abcde="abcde"][data-xyz="xyz"]
a[attr="abcde"][attr="123"]
I also tried more complex examples where quotes may be escaped within the quote:
div:contains("this isn't \"correct\"")
div:contains('this isn\'t correct, "either"')