(elem *VDomElem, comp **ComponentImpl)
| 258 | } |
| 259 | |
| 260 | func (r *RootElem) render(elem *VDomElem, comp **ComponentImpl) { |
| 261 | if elem == nil || elem.Tag == "" { |
| 262 | r.unmount(comp) |
| 263 | return |
| 264 | } |
| 265 | elemKey := elem.Key() |
| 266 | if *comp == nil || !(*comp).compMatch(elem.Tag, elemKey) { |
| 267 | r.unmount(comp) |
| 268 | r.createComp(elem.Tag, elemKey, comp) |
| 269 | } |
| 270 | (*comp).Elem = elem |
| 271 | if elem.Tag == TextTag { |
| 272 | r.renderText(elem.Text, comp) |
| 273 | return |
| 274 | } |
| 275 | if isBaseTag(elem.Tag) { |
| 276 | // simple vdom, fragment, wave element |
| 277 | r.renderSimple(elem, comp) |
| 278 | return |
| 279 | } |
| 280 | cfunc := r.CFuncs[elem.Tag] |
| 281 | if cfunc == nil { |
| 282 | text := fmt.Sprintf("<%s>", elem.Tag) |
| 283 | r.renderText(text, comp) |
| 284 | return |
| 285 | } |
| 286 | r.renderComponent(cfunc, elem, comp) |
| 287 | } |
| 288 | |
| 289 | func (r *RootElem) unmount(comp **ComponentImpl) { |
| 290 | if *comp == nil { |
no test coverage detected