From 764c3c729fcf06221e4cd181b55a035a0b8adcc2 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Tue, 24 Oct 2017 17:49:33 -0700 Subject: [PATCH 1/4] Fix issue that made empty string attribute values trigger changedCallback instead of disconnectedCallback removing an attribute --- attr.js | 2 +- registry.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/attr.js b/attr.js index 85282b4..1520ba6 100644 --- a/attr.js +++ b/attr.js @@ -120,7 +120,7 @@ class CustomAttributeRegistry { } } // Attribute was removed - else if(newVal == null && !!inst.value) { + else if(newVal == null) { inst.value = newVal; if(inst.disconnectedCallback) { inst.disconnectedCallback(); diff --git a/registry.js b/registry.js index cb23605..7180691 100644 --- a/registry.js +++ b/registry.js @@ -117,7 +117,7 @@ class CustomAttributeRegistry { } } // Attribute was removed - else if(newVal == null && !!inst.value) { + else if(newVal == null) { inst.value = newVal; if(inst.disconnectedCallback) { inst.disconnectedCallback(); From e53f71aa9ba5fef805a7113a54df590f3b0de524 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Tue, 24 Oct 2017 17:50:38 -0700 Subject: [PATCH 2/4] Don't change this.value when triggering disconnectedCallback so that disconnectedCallback logic can rely on the value (i.e. the attribute value didn't change, the attribute was removed) --- attr.js | 1 - registry.js | 1 - 2 files changed, 2 deletions(-) diff --git a/attr.js b/attr.js index 1520ba6..719517b 100644 --- a/attr.js +++ b/attr.js @@ -121,7 +121,6 @@ class CustomAttributeRegistry { } // Attribute was removed else if(newVal == null) { - inst.value = newVal; if(inst.disconnectedCallback) { inst.disconnectedCallback(); } diff --git a/registry.js b/registry.js index 7180691..46b1845 100644 --- a/registry.js +++ b/registry.js @@ -118,7 +118,6 @@ class CustomAttributeRegistry { } // Attribute was removed else if(newVal == null) { - inst.value = newVal; if(inst.disconnectedCallback) { inst.disconnectedCallback(); } From 89ed3121e533ab1b8102fe7d2367f03d6534f67b Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Mon, 6 Jul 2020 18:13:06 -0700 Subject: [PATCH 3/4] add a prepare script to make it consumable via git --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ec8f77..8a3ea02 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ }, "scripts": { "build": "pack build", - "test": "testee test/connect.html test/disconnect.html test/change.html --browsers firefox" + "test": "testee test/connect.html test/disconnect.html test/change.html --browsers firefox", + "prepare": "npm run build" }, "repository": { "type": "git", From 416d127ca7676ecea6179e768eb7665c667d8316 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Mon, 6 Jul 2020 19:02:36 -0700 Subject: [PATCH 4/4] add a .npmignore --- .npmignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..70a271d --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +**/* + +!src/ +!pkg/ \ No newline at end of file