diff --git a/bare/impl.nix b/bare/impl.nix
index 7ae0f15..e2a3285 100644
--- a/bare/impl.nix
+++ b/bare/impl.nix
@@ -31,9 +31,10 @@ let
attribute =
tagName: name: value:
let
- facts = spec.elements.${tagName}.attributes.${name} or null;
+ attrs = spec.elements.${tagName}.attributes;
+ facts = attrs.${name} or (if lib.match "^data-.*" name != null then attrs."data-*" else null);
in
- assert lib.assertMsg (facts != null) "fattribute ${name} not allowed on tag ${tagName}";
+ assert lib.assertMsg (facts != null) "attribute ${name} not allowed on tag ${tagName}";
if facts.boolean or false then
assert lib.assertMsg value "non-true value for boolean attribute `${name}` of tag `${tagName}`";
value
diff --git a/bare/system-agnostic-tests/attributes.nix b/bare/system-agnostic-tests/attributes.nix
index d51fa32..5e8cdfb 100644
--- a/bare/system-agnostic-tests/attributes.nix
+++ b/bare/system-agnostic-tests/attributes.nix
@@ -35,6 +35,17 @@ in
expected = ''
'';
};
+ testDataAttributes = {
+ expr =
+ h "div" {
+ "data-toggle" = "modal";
+ "data-target" = "#myModal";
+ class = "btn";
+ } [ "Click me" ]
+ |> serialize;
+ expected = ''