diff --git a/factory.js b/factory.js index aa92aa5..004692f 100644 --- a/factory.js +++ b/factory.js @@ -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; @@ -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; diff --git a/package.json b/package.json index b475d37..70a8102 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chocfactory", - "version": "1.8.1", + "version": "1.8.2", "description": "Simple JS front end library", "main": "factory.js", "scripts": { diff --git a/whatsnew.md b/whatsnew.md index dc1fb67..91f8e7f 100644 --- a/whatsnew.md +++ b/whatsnew.md @@ -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