Parse raw elements, attributes, and web components in rsx (#2655)

* parse raw elements and attributes in rsx

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2024-07-23 16:48:40 -07:00
1 parent fa4e5dbf62
commit 3bb9a535d8
6 files changed
+42 -9

No files matched your search

+3 -3
View File
@@ -63,8 +63,8 @@ pub struct Attribute {
impl Parse for Attribute {
fn parse(content: ParseStream) -> syn::Result<Self> {
// if there's an ident not followed by a colon, it's a shorthand attribute
if content.peek(Ident) && !content.peek2(Token![:]) {
let ident = Ident::parse(content)?;
if content.peek(Ident::peek_any) && !content.peek2(Token![:]) {
let ident = parse_raw_ident(content)?;
let comma = content.parse().ok();
return Ok(Attribute {
@@ -80,7 +80,7 @@ impl Parse for Attribute {
// Parse the name as either a known or custom attribute
let name = match content.peek(LitStr) {
true => AttributeName::Custom(content.parse::<LitStr>()?),
false => AttributeName::BuiltIn(Ident::parse_any(content)?),
false => AttributeName::BuiltIn(parse_raw_ident(content)?),
};
// Ensure there's a colon