aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-10-17 16:25:19 +0200
committerache <ache@ache.one>2018-10-17 16:25:50 +0200
commitc96794e08cc7a33609e16d4155d73218f2d8fad7 (patch)
tree71e64f83ee3a6d0a688fffcdebd8ef45d9849629
parentUpdate deps and version (diff)
Supports aria attributes
-rw-r--r--__tests__/index.js13
-rw-r--r--index.js2
2 files changed, 7 insertions, 8 deletions
diff --git a/__tests__/index.js b/__tests__/index.js
index 199b8e4..7476477 100644
--- a/__tests__/index.js
+++ b/__tests__/index.js
@@ -43,13 +43,6 @@ const generateExtendParser = extendsOptions => text => unified()
const parse = x => parse5.parse(x);
-/*
- * TODO :
- * - Invalid scope
- * - Invalid extended
- * - aria attributes
- */
-
const mainTestString = `Inline *test*{style="em:4"} paragraph. Use **multiple**{ style="color:pink"} inline ~~block~~ tag. Line \`tagCode\`{ style="color:yellow"}.`;
test('basic-default', t => {
@@ -148,3 +141,9 @@ test('invalid-extend', t => {
t.deepEqual(parse(contents), parse(`<p> <em>Wait</em> ! I <strong style="color: red;">love</strong> you!</p>`));
});
+test('global-aria', t => {
+ const invalidString = ` *Wait* ! I **love**{ style="color: pink;" aria-love="true" } you!`;
+ const {contents} = renderDefault(invalidString);
+ t.deepEqual(parse(contents), parse(`<p> <em>Wait</em> ! I <strong style="color: pink;" aria-love="true">love</strong> you!</p>`));
+});
+
diff --git a/index.js b/index.js
index e49768c..2bc6142 100644
--- a/index.js
+++ b/index.js
@@ -131,7 +131,7 @@ function filterAttributes(prop, config, type) {
const isDangerous = p => DOMEventHandler.indexOf(p) >= 0;
const isSpecific = p => type in specific && specific[type].indexOf(p) >= 0;
- const isGlobal = p => htmlElemAttr['*'].indexOf(p) >= 0;
+ const isGlobal = p => htmlElemAttr['*'].indexOf(p) >= 0 || p.match(/^aria-[a-z]{3,24}$/);
let inScope = _ => false;