@@ -101,12 +101,24 @@ export default function undom() {
101101 set : val => { this . setAttribute ( 'style' , val ) ; } ,
102102 get : ( ) => this . getAttribute ( 'style' )
103103 } ) ;
104+ Object . defineProperty ( this , 'innerHTML' , {
105+ set : val => { this . setAttribute ( 'innerHTML' , val ) ; } ,
106+ get : ( ) => this . getAttribute ( 'innerHTML' )
107+ } ) ;
104108 }
105109
106110 get children ( ) {
107111 return this . childNodes . filter ( isElement ) ;
108112 }
109113
114+ insertBefore ( child , ref ) {
115+ super . insertBefore ( child , ref ) ;
116+ let attr = findWhere ( this . attributes , createAttributeFilter ( null , 'innerHTML' ) ) ;
117+ if ( attr ) {
118+ this . removeAttribute ( 'innerHTML' ) ;
119+ }
120+ }
121+
110122 setAttribute ( key , value ) {
111123 this . setAttributeNS ( null , key , value ) ;
112124 }
@@ -121,6 +133,11 @@ export default function undom() {
121133 let attr = findWhere ( this . attributes , createAttributeFilter ( ns , name ) ) ;
122134 if ( ! attr ) this . attributes . push ( attr = { ns, name } ) ;
123135 attr . value = String ( value ) ;
136+ if ( name === 'innerHTML' ) {
137+ while ( this . firstChild ) {
138+ this . removeChild ( this . firstChild ) ;
139+ }
140+ }
124141 }
125142 getAttributeNS ( ns , name ) {
126143 let attr = findWhere ( this . attributes , createAttributeFilter ( ns , name ) ) ;
0 commit comments