33var html = require ( 'property-information/html' )
44var svg = require ( 'property-information/svg' )
55var find = require ( 'property-information/find' )
6+ var ns = require ( 'web-namespaces' )
7+ var s = require ( 'hastscript/svg' )
68var h = require ( 'hastscript' )
79var xtend = require ( 'xtend' )
810var count = require ( 'ccount' )
@@ -48,8 +50,8 @@ function transform(ast, config) {
4850 var node
4951 var pos
5052
51- if ( fn === element && schema . space === 'html' && ast . nodeName === 'svg' ) {
52- config . schema = svg
53+ if ( fn === element ) {
54+ config . schema = ast . namespaceURI === ns . svg ? svg : html
5355 }
5456
5557 if ( ast . childNodes ) {
@@ -131,6 +133,7 @@ function comment(ast) {
131133
132134/* Transform an element. */
133135function element ( ast , children , config ) {
136+ var fn = config . schema . space === 'svg' ? s : h
134137 var name = ast . tagName
135138 var attributes = ast . attrs
136139 var length = attributes . length
@@ -149,7 +152,7 @@ function element(ast, children, config) {
149152 props [ prop ] = attribute . value
150153 }
151154
152- node = h ( name , props , children )
155+ node = fn ( name , props , children )
153156
154157 if ( name === 'template' && 'content' in ast ) {
155158 pos = ast . sourceCodeLocation
0 commit comments