build method

HTMLElement build()

Implementation

HTMLElement build() {
  if (instanceId != null) {
    final Element? existing = document.querySelector(
      '[data-p-id="$instanceId"]',
    );
    // ignore: invalid_runtime_check_with_js_interop_types
    if (existing != null && existing is HTMLElement) {
      host = existing;
      _bindEvents();
      afterRender();
      return host;
    }
  }
  host = document.createElement('div') as HTMLElement;
  render();
  return host;
}