* Support xml namespace prefix for JSX elements and attributes Just as with the `-` character, `:` is now also treated specially in JSX element and attribute names, but is only allowed a single time, and not at the beginning or end of the name, as is specified in the JSX spec. All tests in jsxInvalidEsprimaTestSuite still fail, but for slightly different reasons now. Two lines in jsxEsprimaFbTestSuite were uncommented as they included elements with namespaces, and they now pass without error. * Add case for colons at ends of identifier * Add case for jsx namepsace intrinsics * Add cases with upcase idents for jsx namespaces * Add case for jsx namespaces with react option * Always consider jsx names with colon to be intrinsics * Adjust comment about chars valid in jsx names but not js idents * Fix minor typo in namespace prefix test case variable name * Remove misleading comments on isUnhyphenatedJsxName
28 lines
883 B
TypeScript
28 lines
883 B
TypeScript
//// [jsxNamespacePrefixIntrinsics.tsx]
|
|
declare namespace JSX {
|
|
interface IntrinsicElements {
|
|
"ns:element": {
|
|
"ns:attribute": string;
|
|
},
|
|
"ns:NamespacedUpcaseAlsoIntrinsic": any,
|
|
"NS:NamespacedUpcaseAlsoIntrinsic": any
|
|
}
|
|
}
|
|
|
|
const valid = <ns:element ns:attribute="yep" />;
|
|
const validUpcase1 = <ns:NamespacedUpcaseAlsoIntrinsic />;
|
|
const validUpcase2 = <NS:NamespacedUpcaseAlsoIntrinsic />;
|
|
|
|
const invalid1 = <element />;
|
|
const invalid2 = <ns:element attribute="nope" />;
|
|
const invalid3 = <ns:element ns:invalid="nope" />;
|
|
|
|
|
|
//// [jsxNamespacePrefixIntrinsics.jsx]
|
|
var valid = <ns:element ns:attribute="yep"/>;
|
|
var validUpcase1 = <ns:NamespacedUpcaseAlsoIntrinsic />;
|
|
var validUpcase2 = <NS:NamespacedUpcaseAlsoIntrinsic />;
|
|
var invalid1 = <element />;
|
|
var invalid2 = <ns:element attribute="nope"/>;
|
|
var invalid3 = <ns:element ns:invalid="nope"/>;
|