diff --git a/minidenticons.js b/minidenticons.js
index 46a85a2..75217bb 100644
--- a/minidenticons.js
+++ b/minidenticons.js
@@ -47,13 +47,9 @@ export const identiconSvg =
static observedAttributes = ['username', 'saturation', 'lightness']
// private fields to allow Terser mangling
static #memoized = {}
- #isConnected = false
- connectedCallback() {
- this.#setContent()
- this.#isConnected = true
- }
+ connectedCallback() { this.#setContent() }
// attributeChangedCallback() is called for every observed attribute before connectedCallback()
- attributeChangedCallback() { if (this.#isConnected) this.#setContent() }
+ attributeChangedCallback(name, oldValue) { if (oldValue !== null) this.#setContent() }
#setContent() {
const args = IdenticonSvg.observedAttributes
.map(key => this.getAttribute(key) || undefined)
diff --git a/minidenticons.min.js b/minidenticons.min.js
index 9ebb8a7..019f06a 100644
--- a/minidenticons.min.js
+++ b/minidenticons.min.js
@@ -1 +1 @@
-const t=16777619;export function identicon(e="",n=50,s=50){const i=e.split("").reduce(((e,n)=>((e^n.charCodeAt(0))>>>0)*t),2166136261);const o=i/t%12*30;return[...Array(e?25:0)].reduce(((t,e,n)=>i%(16-n%15)<4?t+``:t),`"}export const identiconSvg=globalThis.customElements?.define("identicon-svg",class t extends HTMLElement{static observedAttributes=["username","saturation","lightness"];static#t={};#e=!1;connectedCallback(){this.#n(),this.#e=!0}attributeChangedCallback(){this.#e&&this.#n()}#n(){const e=t.observedAttributes.map((t=>this.getAttribute(t)||void 0)),n=e.join(",");this.innerHTML=t.#t[n]??=identicon(...e)}});
\ No newline at end of file
+const t=16777619;export function identicon(e="",n=50,s=50){const i=e.split("").reduce(((e,n)=>((e^n.charCodeAt(0))>>>0)*t),2166136261);const o=i/t%12*30;return[...Array(e?25:0)].reduce(((t,e,n)=>i%(16-n%15)<4?t+``:t),`"}export const identiconSvg=globalThis.customElements?.define("identicon-svg",class t extends HTMLElement{static observedAttributes=["username","saturation","lightness"];static#t={};connectedCallback(){this.#e()}attributeChangedCallback(t,e){null!==e&&this.#e()}#e(){const e=t.observedAttributes.map((t=>this.getAttribute(t)||void 0)),n=e.join(",");this.innerHTML=t.#t[n]??=identicon(...e)}});
\ No newline at end of file
diff --git a/minidenticons.min.js.map b/minidenticons.min.js.map
index 713b3ef..8b61ad7 100644
--- a/minidenticons.min.js.map
+++ b/minidenticons.min.js.map
@@ -1 +1 @@
-{"version":3,"names":["FNV_PRIME","identicon","username","saturation","lightness","hash","split","reduce","char","charCodeAt","hue","Array","acc","e","i","identiconSvg","globalThis","customElements","define","IdenticonSvg","HTMLElement","static","isConnected","connectedCallback","this","setContent","attributeChangedCallback","args","observedAttributes","map","key","getAttribute","undefined","memoKey","join","innerHTML","memoized"],"sources":["minidenticons.js"],"mappings":"AACA,MAOMA,EAAY,gBAgBX,SAASC,UAAUC,EAAS,GAAIC,EApBZ,GAoB2CC,EAnB5C,IAoBtB,MAAMC,EAAkBH,EATbI,MAAM,IAEZC,QAAO,CAACF,EAAMG,MAAWH,EAAOG,EAAKC,WAAW,MAAQ,GAAKT,GATjD,YAkBjB,MAAMU,EAAQL,EAAOL,EAxBP,GAwBiC,GAC/C,MAAO,IAAIW,MAAMT,EAAW,GAAK,IAAIK,QAAO,CAACK,EAAKC,EAAGC,IAEjDT,GAAQ,GAAKS,EAAI,IA7BF,EA8BXF,EAAM,YAAYE,EAAI,GAAK,KAAOA,EAAI,MAAQA,EAAI,UAAUA,EAAI,4BAClEF,GAEF,6EAA6EF,KAAOP,MAAeC,SAErG,QACN,QAKO,MAAMW,aAEIC,WAAWC,gBAAgBC,OAAO,gBAC3C,MAAMC,UAAqBC,YACvBC,0BAA4B,CAAC,WAAY,aAAc,aAEvDA,SAAmB,CAAC,EACpBC,IAAe,EACfC,oBACIC,MAAKC,IACLD,MAAKF,GAAe,CACxB,CAEAI,2BAAiCF,MAAKF,GAAcE,MAAKC,GAAc,CACvEA,KACI,MAAME,EAAOR,EAAaS,mBACTC,KAAIC,GAAON,KAAKO,aAAaD,SAAQE,IAChDC,EAAUN,EAAKO,KAAK,KAC1BV,KAAKW,UAAYhB,GAAaiB,EAAUH,KAEpChC,aAAa0B,EACrB"}
\ No newline at end of file
+{"version":3,"names":["FNV_PRIME","identicon","username","saturation","lightness","hash","split","reduce","char","charCodeAt","hue","Array","acc","e","i","identiconSvg","globalThis","customElements","define","IdenticonSvg","HTMLElement","static","connectedCallback","this","setContent","attributeChangedCallback","name","oldValue","args","observedAttributes","map","key","getAttribute","undefined","memoKey","join","innerHTML","memoized"],"sources":["minidenticons.js"],"mappings":"AACA,MAOMA,EAAY,gBAgBX,SAASC,UAAUC,EAAS,GAAIC,EApBZ,GAoB2CC,EAnB5C,IAoBtB,MAAMC,EAAkBH,EATbI,MAAM,IAEZC,QAAO,CAACF,EAAMG,MAAWH,EAAOG,EAAKC,WAAW,MAAQ,GAAKT,GATjD,YAkBjB,MAAMU,EAAQL,EAAOL,EAxBP,GAwBiC,GAC/C,MAAO,IAAIW,MAAMT,EAAW,GAAK,IAAIK,QAAO,CAACK,EAAKC,EAAGC,IAEjDT,GAAQ,GAAKS,EAAI,IA7BF,EA8BXF,EAAM,YAAYE,EAAI,GAAK,KAAOA,EAAI,MAAQA,EAAI,UAAUA,EAAI,4BAClEF,GAEF,6EAA6EF,KAAOP,MAAeC,SAErG,QACN,QAKO,MAAMW,aAEIC,WAAWC,gBAAgBC,OAAO,gBAC3C,MAAMC,UAAqBC,YACvBC,0BAA4B,CAAC,WAAY,aAAc,aAEvDA,SAAmB,CAAC,EACpBC,oBAAsBC,MAAKC,GAAc,CAEzCC,yBAAyBC,EAAMC,GAA6B,OAAbA,GAAmBJ,MAAKC,GAAc,CACrFA,KACI,MAAMI,EAAOT,EAAaU,mBACTC,KAAIC,GAAOR,KAAKS,aAAaD,SAAQE,IAChDC,EAAUN,EAAKO,KAAK,KAC1BZ,KAAKa,UAAYjB,GAAakB,EAAUH,KAEpCjC,aAAa2B,EACrB"}
\ No newline at end of file