Skip to content

Commit

Permalink
Bugfix mixing of lindt and choc
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Oct 21, 2024
1 parent a8b4c42 commit 81881ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ export function replace_content(target, template) {
}
if (t instanceof Element) {
//DOM elements get passed through untouched, and removed from the template.
if (was[i] !== null) pristine = false;
//TODO: This previously only set pristine to false when was[i] wasn't null,
//allowing reuse of DOM elements to be more efficient. This however causes
//*replacement* of DOM elements to be ignored, which is a critical failure.
//It would be nice to reinstate the efficiency when reusing, without losing
//the correctness when replacing.
pristine = false;
now[i] = null;
++nodes;
return t;
Expand Down Expand Up @@ -356,7 +361,7 @@ function autobind(obj, prop) {
choc = new Proxy(choc, {get: autobind});
lindt = new Proxy(lindt, {get: autobind});

choc.__version__ = "1.8.1";
choc.__version__ = "1.8.2";

//For modules, make the main entry-point easily available.
export default choc;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chocfactory",
"version": "1.8.1",
"version": "1.8.2",
"description": "Simple JS front end library",
"main": "factory.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions whatsnew.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Chocolate Factory version history

### v1.8.2
* Bugfix use of DOM elements inside replace_content (can happen when mixing lindt
and choc). Previously it was possible for some such usage to result in elements
not being replaced when they should be.

### v1.8.1
* Bugfix importers not recognizing "import * as name from ..." syntax

Expand Down

0 comments on commit 81881ad

Please sign in to comment.