11import * as React from 'react'
2+
23import { getAttributes , NodeType } from './dom'
34
45export interface Attributes { [ keyof : string ] : string }
@@ -56,12 +57,10 @@ function transformAttributes(attributesMap: NamedNodeMap): Attributes {
5657 const transformedAttributes : Attributes = { }
5758
5859 Object . keys ( attributes ) . forEach ( ( key ) => {
59- if ( ! key . startsWith ( 'on' ) ) {
60- if ( reactAttributesMap [ key ] ) {
61- transformedAttributes [ reactAttributesMap [ key ] ] = attributes [ key ]
62- } else {
63- transformedAttributes [ key ] = attributes [ key ]
64- }
60+ if ( reactAttributesMap [ key ] ) {
61+ transformedAttributes [ reactAttributesMap [ key ] ] = attributes [ key ]
62+ } else {
63+ transformedAttributes [ key ] = attributes [ key ]
6564 }
6665 } )
6766 return transformedAttributes
@@ -73,7 +72,6 @@ function renderTextNode(node: Node & ChildNode) {
7372
7473function renderElementNode ( node : Node & ChildNode ) {
7574 const element = transform ( node as Element )
76-
7775 if ( element . childNodes ) {
7876 return React . createElement ( element . nodeName , element . attributes , render ( element . childNodes ) )
7977 }
@@ -84,14 +82,15 @@ function transform(element: Element) {
8482 return {
8583 attributes : transformAttributes ( element . attributes ) ,
8684 childNodes : element . childNodes ,
87- nodeName : element . nodeName ,
85+ nodeName : element . nodeName . toLowerCase ( ) ,
8886 nodeType : element . nodeType ,
8987 nodeValue : element . nodeValue ,
9088 }
9189}
9290
9391export function render ( nodes : NodeListOf < Node & ChildNode > ) : React . ReactNode [ ] {
9492 const elements = [ ]
93+
9594 for ( let i = 0 ; i < nodes . length ; i ++ ) {
9695 const node = nodes . item ( i )
9796
0 commit comments