-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
Namespace handling makes it impossible to lint recursive SVG / MathML components #2458
Comments
This comment was marked as outdated.
This comment was marked as outdated.
Yes, probably. Thanks for checking! If the issue persists with the newest version of eslint-plugin-vue, please add a comment or open a new issue. |
@FloEdelmann: #2457 adds support for MathML that does not span across multiple files. The issue in this report concerns MathML spanning across multiple components and is still present as described at the top. |
I'm not sure which issue you are reporting exactly. Is an Could you please create a reproduction on playground, Stackblitz, or a separate repository? |
<template>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<Child />
</math>
</template>
<template>
<mi v-text="'x'" /> <!-- vue/no-v-text-v-html-on-component -->
</template> |
@FloEdelmann: playground example (with the usage described in the previous comment) |
I think I finally understand, thanks for your persistence and for the playground example.
As a workaround, you could specify @mordae Do you think this suffices or would you prefer another configuration option (something like |
@FloEdelmann: as I've written initially, it would be nice to relax the namespace check somehow. Allowing SVG and MathML inside HTML namespace as an option would be sufficient. |
What rule do you want to change?
Not exactly a specific rule, but I have been motivated by
vue/no-v-text-v-html-on-component
being falsely triggered on MathML tags.isCustomComponent()
is being called from 17 rules. The problem lies with the fact that every composition component starts with a top-level namespace of HTML, which makes it impossible to create partial, especially recursive components within another namespace without confusing the linter.Does this change cause the rule to produce more or fewer warnings?
Fewer.
How will the change be implemented? (New option, new default behavior, etc.)?
There are multiple options:
xmlns
on the top-level<template/>
and adjust namespace accordingly.Please provide some example code that this change will affect:
What does the rule currently do for this code?
Triggers
vue/no-v-text-v-html-on-component
because it does not see<mfrac/>
as being inside MathML namespace. Which is impossible to realize, because<math/>
cannot be nested and is only specified at the top level. This component recurses into the data, rendering the full MathML structure.What will the rule do after it's changed?
In case of (1), (2), (4) it won't consider using
<mfrac/>
in this context as an error.In case of (3):
It will accept this otherwise invalid, but (probably) harmless syntax to indicate that we are inside MathML namespace and proceed from there on, possibly marking HTML and SVG elements as out of place.
Additional context
This obviously applies to SVG as well, although there is not that high probability somebody will be doing anything recursive in there. Math is a different story, though.
The text was updated successfully, but these errors were encountered: