@unhead/dom 1.0.14 → 1.0.16

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/dist/index.cjs CHANGED
@@ -145,12 +145,16 @@ async function renderDOMHead(head, options = {}) {
145
145
  Object.entries(pendingRenders).forEach(([pos, queue]) => {
146
146
  if (!queue.length)
147
147
  return;
148
- for (const $el of [...dom[pos].children].reverse()) {
148
+ const children = dom?.[pos]?.children;
149
+ if (!children)
150
+ return;
151
+ for (const $el of [...children].reverse()) {
149
152
  const elTag = $el.tagName.toLowerCase();
150
153
  if (!HasElementTags.includes(elTag))
151
154
  continue;
152
155
  const dedupeKey = tagDedupeKey({
153
156
  tag: elTag,
157
+ // convert attributes to object
154
158
  props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
155
159
  });
156
160
  const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode(ctx2.$el)));
package/dist/index.mjs CHANGED
@@ -143,12 +143,16 @@ async function renderDOMHead(head, options = {}) {
143
143
  Object.entries(pendingRenders).forEach(([pos, queue]) => {
144
144
  if (!queue.length)
145
145
  return;
146
- for (const $el of [...dom[pos].children].reverse()) {
146
+ const children = dom?.[pos]?.children;
147
+ if (!children)
148
+ return;
149
+ for (const $el of [...children].reverse()) {
147
150
  const elTag = $el.tagName.toLowerCase();
148
151
  if (!HasElementTags.includes(elTag))
149
152
  continue;
150
153
  const dedupeKey = tagDedupeKey({
151
154
  tag: elTag,
155
+ // convert attributes to object
152
156
  props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
153
157
  });
154
158
  const matchIdx = queue.findIndex((ctx2) => ctx2 && (ctx2.tag._d === dedupeKey || $el.isEqualNode(ctx2.$el)));
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@unhead/dom",
3
3
  "type": "module",
4
- "version": "1.0.14",
5
- "packageManager": "pnpm@7.19.0",
4
+ "version": "1.0.16",
5
+ "packageManager": "pnpm@7.25.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -30,7 +30,7 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@unhead/schema": "1.0.14"
33
+ "@unhead/schema": "1.0.16"
34
34
  },
35
35
  "devDependencies": {
36
36
  "zhead": "^1.0.9"