All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
- #162 - Extending components.
- #173 - The presence of the
resolvedattribute skips thetemplatecallback. - #177 -
skate.create()as an alternative todocument.createElement(). - #178 -
eventsnow support an array of handlers. - #187 -
attributehandlers are now synchronous. - #197 - Event delegation support for selectors containing
::shadow. - #200 - Support for a
propertiesdefinition that defines instance properties and their behaviour. - #206 - Element constructors can be called like a function, or instantiated like a constructor.
- #205 - Lifecycle callbacks now use
this. - #208 -
attributesare no longer granular and is now closer to the spec. - #209 - Renamed
attributestoattributebecause now it's just a single callback. - #210 - Renamed
lib/skate.jsandsrc/skate.jstolib/index.jsandsrc/index.js.
- #141 - Lifecycle callbacks called separately. First
createdis called on all elements thenattachedis called on all elements. Before,createdandattachedwould be invoked on an element before moving on to the next. - #174 - Polyfilled custom element prototype members not inherited
- #184 - The
skate.defaultsproperty is no longer public and has been removed. No alternative will be provided. - #187 - Modifying
element.attributesdirectly no longer triggers theattributecallback.
The following callbacks now use this to refer to the element instead of it being passed as the first argument:
createdattacheddetachedattributeeventstemplate
For example, this:
created (element) {
element.textContent = 'Hello, World!';
}Is now this:
created () {
this.textContent = 'Hello, World!';
}- You may now only specify a callback as the
attributeoption. - The signature of the callback matches the web component spec.
- Use
thisto refer to the element. - Arguments are:
name,oldValueandnewValuein that order.
- Use
Previous:
attributes: {
myAttribute1 (element, changes) {},
myAttribute2: {
value: 'initial value'
},
myAttribute3: {
value () {
return 'initial value';
}
},
myAttribute4: {
created (element, changes) {},
updated (element, changes) {},
removed (element, changes) {},
}
}Current:
attribute (name, oldValue, newValue) {
}To translate the above variations to the new properties option, you would do the following:
properties: {
myAttribute1: {
attr: true,
set (newValue, oldValue) {
}
},
myAttribute2: {
attr: true,
value: 'initial value',
set (newValue, oldValue) {
}
},
myAttribute3: {
attr: true,
value () {
return 'initial value';
}
},
myAttribute4: {
attr: true,
set (newValue, oldValue) {
if (oldValue === null) {
// created
} else if (newValue === null) {
// removed
} else {
// updated
}
}
}
}When set is called, newValue and oldValue have the same meaning as when used inside the attribute callback.
Wherever you're specifying the attributes option, just rename it to attribute (singular).
If you're using the ES6 or UMD versions of Skate (lib and src folders), rename the reference to the skate file to index.