-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Allow unknown namespaced attributes to be emitted in their original case #5387
Conversation
The getmetadata already returned null for namespaced items. But you are
right that it might not always be the case and I should probably move it
outside the if.
…On Mon, 14 Sep 2020, 1:22 am Tan Li Hau, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/compiler/compile/render_dom/wrappers/Element/Attribute.ts
<#5387 (comment)>:
> @@ -65,17 +66,33 @@ export default class AttributeWrapper extends BaseAttributeWrapper {
handle_select_value_binding(this, node.dependencies);
}
}
+
+ const namespace = this.parent.node.namespace;
+ // some processing only applies to html namespace (and not MathML, SVG, or Svelte Native etc)
+ if (namespace && namespace != 'html' && namespace != namespaces.html) {
+ // attributes outside of the html namespace may be case sensitive
+ // namespaces for which we don't have case corrections, are left in their original case (required for svelte-native)
+ this.name = (valid_namespaces.indexOf(namespace) >= 0) ? fix_attribute_casing(this.node.name) : this.node.name;
it seemed this is not just about the attribute name case, also set all the
metadata to null right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5387 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEGS5FFRSO26TUDB3HB6O3SFTPTLANCNFSM4RHILVXA>
.
|
8b9476e
to
e7125f3
Compare
I changed package.json's lint script to work on windows |
A more comprehensive solution to out of HTML namespace support is here #5652 |
Closing this, as #5652 has landed in 3.32.0. |
Hi @Conduitry and @halfnelson svelte/src/compiler/compile/nodes/Element.ts Line 601 in 6207596
The validator just says all bindings are invalid. So even a |
This PR allows attribute case to be retained for elements not in any of the known namespaces.
Current code forces all to lowercase and fixes the SVG specific attributes. There are other namespaces which contain case sensitive attributes, such as Svelte Native.
Currently svelte native has to recurse the object prototype of the element being updated and try to resolve the correct case. This has been a never ending source of bugs.
This PR also avoids setting several other Attribute values that only apply to code in the html namespace.
Before this fix
After
Might be able to be merged with #5193
Tests
Test in
test/runtime/samples/attribute/casing-unknown-namespace