This repository was archived by the owner on Aug 24, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
packages/h2x-plugin-jsx/src Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -101,4 +101,11 @@ describe('transformJsx', () => {
101101 `<div id="foo" style={{"fontSize":10,"lineHeight":1.2}} />` ,
102102 )
103103 } )
104+
105+ it ( 'should handle special SVG attributes' , ( ) => {
106+ const code = `<svg autoReverse="false" externalResourcesRequired="true" focusable="true" preserveAlpha="false"></svg>`
107+ expect ( transform ( code , { plugins : [ transformJsx ] } ) . trim ( ) ) . toBe (
108+ '<svg autoReverse="false" externalResourcesRequired="true" focusable="true" preserveAlpha="false" />' ,
109+ )
110+ } )
104111} )
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import { isNumeric, hyphenToCamelCase } from './util'
77const ATTRIBUTE_MAPPING = {
88 for : 'htmlFor' ,
99 class : 'className' ,
10+ autoreverse : 'autoReverse' ,
11+ externalresourcesrequired : 'externalResourcesRequired' ,
1012}
1113
1214const ELEMENT_ATTRIBUTE_MAPPING = {
@@ -155,7 +157,6 @@ export default {
155157 HTMLElement : {
156158 enter ( path ) {
157159 const jsxElement = new JSXElement ( )
158-
159160 jsxElement . name = transformTagName ( path . node . tagName )
160161 jsxElement . attributes = listToArray ( path . node . attributes )
161162 jsxElement . children = listToArray ( path . node . childNodes )
You can’t perform that action at this time.
0 commit comments