Skip to content

Commit 5939cc1

Browse files
author
Graham Butler
committed
prevent attribute.change event from firing when new attr value is the same as the old one
1 parent c754968 commit 5939cc1

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
- Add cloak
2+
- Add 'connected' & 'rendered' properties
3+
- Add 'once' listener

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@author.io/element-base",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "Base class for all author-* custom elements (web components).",
55
"main": "dist/author-base.min.js",
66
"scripts": {

src/element.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,10 @@ const AuthorBaseElement = superClass => class extends superClass {
979979
* Fires after change has been applied to matching properties.
980980
*/
981981
attributeChangedCallback (attribute, oldValue, newValue) {
982+
if (newValue === oldValue) {
983+
return
984+
}
985+
982986
this.emit('attribute.change', {
983987
attribute,
984988
oldValue,
@@ -1046,6 +1050,7 @@ const AuthorBaseElement = superClass => class extends superClass {
10461050
}
10471051

10481052
this.dispatchEvent(event)
1053+
return event
10491054
}
10501055

10511056
/**

0 commit comments

Comments
 (0)