ocsigen/tyxml

jsx: className attr transform is applied to "uppercase components"

jchavarri opened this issue · 0 comments

It seems JSX ppx renames className attribute to class for elements generated from uppercase components. This results in the createElement application being passed a ~class argument, which doesn't make sense as it's a reserved word.

To repro:

module Foo = {
  let createElement = (~className, ()) => {
    <div className />;
  };
};
let el = <Foo className="bar" />

Error:

The function applied to this argument has type
  (~className: Tyxml.Html.wrap(Html_types.nmtokens)) => Tyxml_html.elt([> Html_types.div ])
This argument cannot be applied with label ~class

Should attribute mangling only be applied to elements generated from lowercase components?