gonia 0.3.2 → 0.3.3

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.
@@ -224,13 +224,23 @@ export async function render(html, state, registry) {
224
224
  return true;
225
225
  };
226
226
  const observer = new window.MutationObserver((mutations) => {
227
+ // Collect all direct addedNodes first to avoid processing them as descendants
228
+ const directNodes = new Set();
229
+ for (const mutation of mutations) {
230
+ for (const node of mutation.addedNodes) {
231
+ if (node.nodeType === 1) {
232
+ directNodes.add(node);
233
+ }
234
+ }
235
+ }
227
236
  for (const mutation of mutations) {
228
237
  for (const node of mutation.addedNodes) {
229
238
  if (node.nodeType !== 1)
230
239
  continue;
231
240
  const el = node;
232
241
  const matches = el.matches(selector) ? [el] : [];
233
- const descendants = [...el.querySelectorAll(selector)];
242
+ // Filter out descendants that will be processed as direct addedNodes
243
+ const descendants = [...el.querySelectorAll(selector)].filter(desc => !directNodes.has(desc));
234
244
  for (const match of [...matches, ...descendants]) {
235
245
  // Skip elements inside template content (used as placeholders)
236
246
  if (match.closest('template')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gonia",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "A lightweight, SSR-first reactive UI library with declarative directives",
5
5
  "type": "module",
6
6
  "license": "MIT",