Adjust the regex used to find matching tags. The regex was extended to support a dot (.) in the middle of the tag so that member access in JSX is now supported (e.g. <Grid.Row>). To support deep member access the existing suffix part of the regex was changed from zero or once ? to N times *. This now also enables deep nesting of XML namespaces (<custom:test:tag>).
I also added a test case containing attributes. I didn't change anything about that but I wanted to make sure that that behavior is tested.
Alternate Designs
To my knowledge deep nesting of XML namespace is not valid. So we could have just not allowed it but this way the regex stays simpler.
In addition, using deeply nested XML namespaces would have resulted in strange behavior. Now it is what the user would expect. I.e. just closing the tag no matter what.
Benefits
JSX Tags with member access can now be closed. Before the change:
<Foo.Bar>
/* closing the tag here resulted in </Foo> instead of </Foo.Bar> */
<div>
<Foo.Bar></Foo.Bar>
/* closing the tag here resulted in </Foo> instead of </div> */
Possible Drawbacks
This should have no performance impact but might perhaps break tag matching in some cases.
I can't think of anything and all tests are passing but regexes are fragile.
Description of the Change
Adjust the regex used to find matching tags. The regex was extended to support a dot (
.
) in the middle of the tag so that member access in JSX is now supported (e.g.<Grid.Row>
). To support deep member access the existing suffix part of the regex was changed from zero or once?
to N times*
. This now also enables deep nesting of XML namespaces (<custom:test:tag>
).I also added a test case containing attributes. I didn't change anything about that but I wanted to make sure that that behavior is tested.
Alternate Designs
To my knowledge deep nesting of XML namespace is not valid. So we could have just not allowed it but this way the regex stays simpler.
In addition, using deeply nested XML namespaces would have resulted in strange behavior. Now it is what the user would expect. I.e. just closing the tag no matter what.
Benefits
JSX Tags with member access can now be closed. Before the change:
Possible Drawbacks
This should have no performance impact but might perhaps break tag matching in some cases. I can't think of anything and all tests are passing but regexes are fragile.
Applicable Issues
No issue yet