@erickxavier/no-js 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/globals.js CHANGED
@@ -16,7 +16,6 @@ export const _config = {
16
16
  i18n: { defaultLocale: "en", fallbackLocale: "en", detectBrowser: false, loadPath: null, ns: [], cache: true, persist: false },
17
17
  debug: false,
18
18
  devtools: false,
19
- csp: null,
20
19
  sanitize: true,
21
20
  };
22
21
 
@@ -62,7 +61,11 @@ export function _notifyStoreWatchers() {
62
61
  }
63
62
 
64
63
  export function _watchExpr(expr, ctx, fn) {
65
- ctx.$watch(fn);
64
+ const unwatch = ctx.$watch(fn);
65
+ _onDispose(() => {
66
+ unwatch();
67
+ _storeWatchers.delete(fn);
68
+ });
66
69
  if (typeof expr === "string" && expr.includes("$store")) {
67
70
  _storeWatchers.add(fn);
68
71
  }
package/src/index.js CHANGED
@@ -83,6 +83,10 @@ const NoJS = {
83
83
  const prevTemplates = { ..._config.templates };
84
84
  const prevRouter = { ..._config.router };
85
85
  const prevI18n = { ..._config.i18n };
86
+ if ("csp" in opts) {
87
+ _warn("csp config option removed — No.JS is now CSP-safe by default");
88
+ delete opts.csp;
89
+ }
86
90
  Object.assign(_config, opts);
87
91
  if (opts.headers)
88
92
  _config.headers = { ...prevHeaders, ...opts.headers };
@@ -240,7 +244,7 @@ const NoJS = {
240
244
  resolve,
241
245
 
242
246
  // Version
243
- version: "1.8.1",
247
+ version: "1.9.0",
244
248
  };
245
249
 
246
250
  export default NoJS;
package/src/registry.js CHANGED
@@ -106,3 +106,9 @@ export function _disposeTree(root) {
106
106
  const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
107
107
  while (walker.nextNode()) _disposeElement(walker.currentNode);
108
108
  }
109
+
110
+ export function _disposeChildren(parent) {
111
+ if (!parent) return;
112
+ const walker = document.createTreeWalker(parent, NodeFilter.SHOW_ELEMENT);
113
+ while (walker.nextNode()) _disposeElement(walker.currentNode);
114
+ }