From fc412a77424e84fc5532050c8fd3ed4fd8ca4703 Mon Sep 17 00:00:00 2001 From: Sascha Tandel Date: Sat, 26 Dec 2020 12:49:11 +0100 Subject: [PATCH] doc: invoke super methods in example --- docs/observe.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/observe.md b/docs/observe.md index 48292a4f7..cd3825a74 100644 --- a/docs/observe.md +++ b/docs/observe.md @@ -82,7 +82,9 @@ observer.disconnect(node) ## Example -> This example show how a custom observer instance can be used to shim a web component. +This example shows how a custom observer instance can be used to shim a web component. + +> This example is using [Constructable Stylesheet Objects](https://wicg.github.io/construct-stylesheets/) and `DocumentOrShadowRoot.adoptedStyleSheets` which have [limited browser support](https://caniuse.com/mdn-api_documentorshadowroot_adoptedstylesheets) at the moment (December 2020). ```js import { LitElement, html } from 'lit-element' @@ -101,11 +103,13 @@ class TwindElement extends LitElement { // 4. Start observing class attributes changes connectedCallback() { + super.connectedCallback() this._observer = createObserver(instance).observe(this.renderRoot) } // 5. Stop observing class attributes changes disconnectedCallback() { + super.disconnectedCallback() this._observer.disconnect() }