Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
fix: fix namespaced attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Sep 1, 2017
1 parent 1f3ca0c commit 6972f9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/h2x-plugin-jsx/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('transformJsx', () => {

expect(transform(code, { plugins: [transformJsx] }).trim())
.toBe(`{/*?xml version="1.0" encoding="UTF-8"?*/}
<svg width="88px" height="88px" viewBox="0 0 88 88" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="88px" height="88px" viewBox="0 0 88 88" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
{/*Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch*/}
<title>
Dismiss
Expand Down
5 changes: 2 additions & 3 deletions packages/h2x-plugin-jsx/src/visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ function hyphenToCamelCase(string) {
function getAttributeName(attribute, node) {
if (
!attribute.name.startsWith('aria-') &&
!attribute.name.startsWith('data-') &&
!attribute.name.includes(':')
!attribute.name.startsWith('data-')
) {
return (
(ELEMENT_ATTRIBUTE_MAPPING[node.name] &&
ELEMENT_ATTRIBUTE_MAPPING[node.name][attribute.name]) ||
ATTRIBUTE_MAPPING[attribute.name] ||
hyphenToCamelCase(attribute.name)
hyphenToCamelCase(attribute.name.replace(':', '-'))
)
}

Expand Down

0 comments on commit 6972f9d

Please sign in to comment.