Open wangchaoyuwangchaoyu opened 6 years ago
I know its been a while since you've filed this issue, but I wonder how the code above is a NodeJS code snippet, because to my knowledge NodeJS never supported E4x and the code snippet above definetly is E4X syntax, so not valid plain JavaScript.
Or might you have used https://www.npmjs.com/package/babel-plugin-transform-simple-e4x?
This is a bug though: <div><span></span></div>
works, <div>{new XML('<span></span>')}</div>
works, but <div>{<span></span>}</div>
doesnt.
Problem lies in the call to TokenStream.getFirstXMLToken() in Parser.xmlInitializer(): .getFirstXMLToken() resets TokenStream.xmlOpenTagsCount to 0, which messes stuff up: the Rhino code doesn't account for nested XML literals, which is what is happening in <div>{<span></span>}</div>
, where <span></span>
is a nested XML literal within an epression in the outer XML literal
Node Code Snippet :
If have '{}' in XML ,it cannot be parsing correctly.