chore: adjust attribute macro
This commit is contained in:
1 parent
a0b0558624
commit
2409d499e0
1 file changed
+12
-4
@@ -5,15 +5,21 @@ use crate::AttributeDiscription;
|
|||||||
macro_rules! trait_methods {
|
macro_rules! trait_methods {
|
||||||
(
|
(
|
||||||
@base
|
@base
|
||||||
|
|
||||||
|
$(#[$trait_attr:meta])*
|
||||||
|
$trait:ident;
|
||||||
$(
|
$(
|
||||||
$(#[$attr:meta])*
|
$(#[$attr:meta])*
|
||||||
$name:ident $(: $($arg:literal),*)*;
|
$name:ident $(: $($arg:literal),*)*;
|
||||||
)+
|
)+
|
||||||
) => {
|
) => {
|
||||||
|
$(#[$trait_attr])*
|
||||||
|
pub trait $trait {
|
||||||
$(
|
$(
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; };
|
const $name: AttributeDiscription = trait_methods! { $name $(: $($arg),*)*; };
|
||||||
)*
|
)*
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rename the incoming ident and apply a custom namespace
|
// Rename the incoming ident and apply a custom namespace
|
||||||
@@ -25,10 +31,12 @@ macro_rules! trait_methods {
|
|||||||
// Don't rename the incoming ident
|
// Don't rename the incoming ident
|
||||||
( $name:ident; ) => { (stringify!($name), None, false) };
|
( $name:ident; ) => { (stringify!($name), None, false) };
|
||||||
}
|
}
|
||||||
pub trait GlobalAttributes {
|
|
||||||
trait_methods! {
|
trait_methods! {
|
||||||
@base
|
@base
|
||||||
|
|
||||||
|
GlobalAttributes;
|
||||||
|
|
||||||
/// Prevent the default action for this element.
|
/// Prevent the default action for this element.
|
||||||
///
|
///
|
||||||
/// For more information, see the MDN docs:
|
/// For more information, see the MDN docs:
|
||||||
@@ -1534,12 +1542,12 @@ pub trait GlobalAttributes {
|
|||||||
/// <https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize>
|
/// <https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize>
|
||||||
aria_setsize: "aria-setsize";
|
aria_setsize: "aria-setsize";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pub trait SvgAttributes {
|
|
||||||
trait_methods! {
|
trait_methods! {
|
||||||
@base
|
@base
|
||||||
|
|
||||||
|
SvgAttributes;
|
||||||
|
|
||||||
/// Prevent the default action for this element.
|
/// Prevent the default action for this element.
|
||||||
///
|
///
|
||||||
/// For more information, see the MDN docs:
|
/// For more information, see the MDN docs:
|
||||||
@@ -2293,5 +2301,5 @@ pub trait SvgAttributes {
|
|||||||
|
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/zoomAndPan>
|
/// <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/zoomAndPan>
|
||||||
zoomAndPan: "zoomAndPan";
|
zoomAndPan: "zoomAndPan";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user