isEqual static method

bool isEqual(
  1. VNode vNode1,
  2. VNode vNode2
)

Implementation

static bool isEqual(VNode vNode1, VNode vNode2) {
  switch (vNode1.kind) {
    case VNodeKind.component:
      if (vNode2.kind != VNodeKind.component) {
        return false;
      }

      vNode1 = vNode1 as VComponent;
      vNode2 = vNode2 as VComponent;
      final component1 = vNode1.component;
      final component2 = vNode2.component;
      return component1.runtimeType == component2.runtimeType &&
          component1.key == component2.key;
    case VNodeKind.element:
      if (vNode2.kind != VNodeKind.element) {
        return false;
      }

      vNode1 = vNode1 as VElement;
      vNode2 = vNode2 as VElement;
      return vNode1.tagName == vNode2.tagName &&
          vNode1.isShadowRootUsed == vNode2.isShadowRootUsed;
    case VNodeKind.html:
      if (vNode2.kind != VNodeKind.html) {
        return false;
      }

      vNode1 = vNode1 as VHtml;
      vNode2 = vNode2 as VHtml;
      return vNode1.tagName == vNode2.tagName;
    case VNodeKind.text:
      return vNode2.kind == VNodeKind.text;
  }
}