Skip to content

Commit 54f0d43

Browse files
committed
Add test verifying that namedspaced JSX attributes are ignored
1 parent 10e0c19 commit 54f0d43

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ function transformJavaScript(ast, { env }) {
521521
return
522522
}
523523

524+
// We don't want to support namespaced attributes (e.g. `somens:class`)
525+
// React doesn't support them and most tools don't either
526+
if (typeof node.name.name !== 'string') {
527+
return
528+
}
529+
524530
if (!staticAttrs.has(node.name.name)) {
525531
return
526532
}

tests/format.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ let css = [
1919

2020
let javascript = [
2121
t`;<div class="${yes}" />`,
22+
t`;<div ns:class="${no}" />`,
2223
t`/* <div class="${no}" /> */`,
2324
t`// <div class="${no}" />`,
2425
t`;<div not-class="${no}" />`,

0 commit comments

Comments
 (0)