@unhead/dom 0.6.1 → 0.6.2

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
@@ -93,9 +93,12 @@ async function renderDOMHead(head, options = {}) {
93
93
  setAttrs($newEl, false);
94
94
  let $previousEl;
95
95
  for (const $el of dom[tag.tagPosition?.startsWith("body") ? "body" : "head"].children) {
96
+ const elTag = $el.tagName.toLowerCase();
97
+ if (elTag !== tag.tag)
98
+ continue;
96
99
  const key = $el.getAttribute("data-h-key") || tagDedupeKey({
97
- tag: $el.tagName.toLowerCase(),
98
- props: Array.from($el.attributes).map((attr) => [attr.name, attr.value]).reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
100
+ tag: elTag,
101
+ props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
99
102
  });
100
103
  if (key === tag._d || $el.isEqualNode($newEl)) {
101
104
  $previousEl = $el;
package/dist/index.mjs CHANGED
@@ -91,9 +91,12 @@ async function renderDOMHead(head, options = {}) {
91
91
  setAttrs($newEl, false);
92
92
  let $previousEl;
93
93
  for (const $el of dom[tag.tagPosition?.startsWith("body") ? "body" : "head"].children) {
94
+ const elTag = $el.tagName.toLowerCase();
95
+ if (elTag !== tag.tag)
96
+ continue;
94
97
  const key = $el.getAttribute("data-h-key") || tagDedupeKey({
95
- tag: $el.tagName.toLowerCase(),
96
- props: Array.from($el.attributes).map((attr) => [attr.name, attr.value]).reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
98
+ tag: elTag,
99
+ props: $el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
97
100
  });
98
101
  if (key === tag._d || $el.isEqualNode($newEl)) {
99
102
  $previousEl = $el;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/dom",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.6.2",
5
5
  "packageManager": "pnpm@7.14.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@unhead/schema": "0.6.1"
33
+ "@unhead/schema": "0.6.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "zhead": "1.0.0-beta.13"