Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

TagFinder.findEndTag matches by substring, not exact tag names #394

Open
sjuvonen opened this issue Feb 16, 2020 · 0 comments
Open

TagFinder.findEndTag matches by substring, not exact tag names #394

sjuvonen opened this issue Feb 16, 2020 · 0 comments

Comments

@sjuvonen
Copy link

sjuvonen commented Feb 16, 2020

I am using the TagFinder class provided by this package in my own Atom package and have an issue with its behavior. Its method findEndTag() matches tag names by substring and will therefore result in false positives, messing up any attempt at proper tag matching.

Consider this snippet:

<foo-t>
  <foo-too></foo-too>
</foo-t>

If I execute TagFinder.findEndTag('foo-t', { row: 0, column: 7 }), the method will return 'foo-too', matching the wrong end tag on line 2, instead of the actual end tag on line 3.

Looking at how the regular expression for matching tags is written, this could even be intended behavior, as the regex is clearly written to allow any end tag that simply starts with the passed name. Therefore I don't provide any suggestions for patching this. At least it could be checked after the regex matching that captured tag name is an exact match and not a simple substring match.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant