danieldietrich / candid

Candid is a surprisingly fresh and frameworkless JavaScript library for building web applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Root

danieldietrich opened this issue · comments

If the web-component has mode="open" or mode="closed" then the root is of type ShadowRoot.

const { root } = this.ctx;

// = true
root instanceof ShadowRoot

// = false
root === this

If the web-component has no mode set, then the root is the element.

const { root } = this.ctx;

// = true
root instanceof HTMLElement

// = true
root === this