Removed:
- Remove AMD publish target since its EOL: requirejs/requirejs#1816 (comment)
- Remove CommonJS publish target.
require("idiomorph")no longer resolves; useimport "idiomorph"instead. (@botandrose) #122 - Remove the undocumented
head.ignoreoption in favour ofhead: {style: 'none'}, which the README has always documented (@botandrose)
Changed:
morph()now accepts anyNodeas its first argument, rather than only anElementorDocument. Passing a node that cannot have children withmorphStyle: 'innerHTML'now throws instead of failing obscurely (@botandrose, @lizarusi) #155- The package is now declared ESM via
"type": "module", soimport "idiomorph"resolves without relying on Node's module syntax detection (@myabc)
Added:
- Publish TypeScript declarations, generated from the JSDoc types already in the source (@myabc) #152
- Warn in the console when duplicate ids are detected during a morph, since they can cause subtle state loss (@botandrose) #142
Fixed:
- Fix TypeError when restoring focus to an element that doesn't support text selection (@emaia) #150
- Skip the
beforeAttributeUpdatedcallback when an attribute's value is unchanged (@monorkin) #149 - Preserve the namespace of recreated elements, so SVG and MathML content containing persistent ids is no longer rebuilt as HTML (@guoliu, @botandrose) #154
- Morph namespaced attributes such as
xlink:href, and attribute names thatsetAttributerejects such as Alpine's@clickor Vue's:class, which previously lost their namespace or threw anInvalidCharacterError(@botandrose) #147 - Fix TypeError when morphing a text or comment node via
outerHTML(@lizarusi) #155 - Fix focus restoration never running when
head: { block: true }defers the morph (@botandrose) - Fix
head: {style: 'none'}, which had silently behaved asmerge(@botandrose) - Throw on an unrecognized
head.style, rather than silently falling back tomerge(@botandrose) - Support morphing nodes from other documents, e.g. an iframe's
contentDocument, which previously threw a TypeError (@lizarusi, @myabc) #156 - Fix morphing another document produces a tree of mixed-realm nodes (@botandrose)
- Fix morphing another document loses the element's state (@botandrose)
- Fix
ignoreActiveandignoreActiveValuewhile morphing another document (@botandrose) - Fix pantry morph confusion while morphing another document (@botandrose)
- Escape ids before using them in attribute selectors, so ids containing CSS-special characters no longer break matching (@botandrose)
- Ignore empty ids when computing the persistent id set (@botandrose)
- Strip the doctype when parsing new content, so morphing a full document no longer throws (@botandrose)
- Read
idandtagNameoff the element itself, so form controls containing fields namedidortagNamecannot shadow them (@botandrose) - Read each id once when building the id set, instead of twice downstream, for a small perf win (@botandrose)
New Contributors
- @monorkin made their first contribution in #149
- @emaia made their first contribution in #150
- @myabc made their first contribution in #153
- @lizarusi made their first contribution in #155
Full Changelog: v0.7.4...v0.8.0