svelte 4.0.2 → 4.0.4
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/compiler.cjs +1 -1
- package/package.json +1 -1
- package/src/runtime/internal/dom.js +15 -20
- package/src/runtime/internal/utils.js +2 -2
- package/src/shared/version.js +1 -1
package/compiler.cjs
CHANGED
|
@@ -43708,7 +43708,7 @@ function is_used_as_reference(node, parent) {
|
|
|
43708
43708
|
* https://svelte.dev/docs/svelte-compiler#svelte-version
|
|
43709
43709
|
* @type {string}
|
|
43710
43710
|
*/
|
|
43711
|
-
const VERSION = '4.0.
|
|
43711
|
+
const VERSION = '4.0.4';
|
|
43712
43712
|
|
|
43713
43713
|
const regex_leading_directory_separator = /^[/\\]/;
|
|
43714
43714
|
const regex_starts_with_term_export = /^Export/;
|
package/package.json
CHANGED
|
@@ -777,14 +777,14 @@ export function claim_comment(nodes, data) {
|
|
|
777
777
|
);
|
|
778
778
|
}
|
|
779
779
|
|
|
780
|
-
function
|
|
780
|
+
function get_comment_idx(nodes, text, start) {
|
|
781
781
|
for (let i = start; i < nodes.length; i += 1) {
|
|
782
782
|
const node = nodes[i];
|
|
783
783
|
if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {
|
|
784
784
|
return i;
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
return
|
|
787
|
+
return -1;
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
/**
|
|
@@ -793,11 +793,12 @@ function find_comment(nodes, text, start) {
|
|
|
793
793
|
*/
|
|
794
794
|
export function claim_html_tag(nodes, is_svg) {
|
|
795
795
|
// find html opening tag
|
|
796
|
-
const start_index =
|
|
797
|
-
const end_index =
|
|
798
|
-
if (start_index === end_index) {
|
|
799
|
-
return new HtmlTagHydration(
|
|
796
|
+
const start_index = get_comment_idx(nodes, 'HTML_TAG_START', 0);
|
|
797
|
+
const end_index = get_comment_idx(nodes, 'HTML_TAG_END', start_index + 1);
|
|
798
|
+
if (start_index === -1 || end_index === -1) {
|
|
799
|
+
return new HtmlTagHydration(is_svg);
|
|
800
800
|
}
|
|
801
|
+
|
|
801
802
|
init_claim_info(nodes);
|
|
802
803
|
const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);
|
|
803
804
|
detach(html_tag_nodes[0]);
|
|
@@ -807,7 +808,7 @@ export function claim_html_tag(nodes, is_svg) {
|
|
|
807
808
|
n.claim_order = nodes.claim_info.total_claimed;
|
|
808
809
|
nodes.claim_info.total_claimed += 1;
|
|
809
810
|
}
|
|
810
|
-
return new HtmlTagHydration(
|
|
811
|
+
return new HtmlTagHydration(is_svg, claimed_nodes);
|
|
811
812
|
}
|
|
812
813
|
|
|
813
814
|
/**
|
|
@@ -1048,17 +1049,13 @@ export class HtmlTag {
|
|
|
1048
1049
|
* @default false
|
|
1049
1050
|
*/
|
|
1050
1051
|
is_svg = false;
|
|
1051
|
-
|
|
1052
|
-
/** */
|
|
1052
|
+
/** parent for creating node */
|
|
1053
1053
|
e = undefined;
|
|
1054
|
-
|
|
1055
|
-
/** */
|
|
1054
|
+
/** html tag nodes */
|
|
1056
1055
|
n = undefined;
|
|
1057
|
-
|
|
1058
|
-
/** */
|
|
1056
|
+
/** target */
|
|
1059
1057
|
t = undefined;
|
|
1060
|
-
|
|
1061
|
-
/** */
|
|
1058
|
+
/** anchor */
|
|
1062
1059
|
a = undefined;
|
|
1063
1060
|
constructor(is_svg = false) {
|
|
1064
1061
|
this.is_svg = is_svg;
|
|
@@ -1134,13 +1131,11 @@ export class HtmlTag {
|
|
|
1134
1131
|
}
|
|
1135
1132
|
}
|
|
1136
1133
|
|
|
1137
|
-
/**
|
|
1138
|
-
* @extends HtmlTag */
|
|
1139
1134
|
export class HtmlTagHydration extends HtmlTag {
|
|
1140
|
-
|
|
1141
|
-
/** */
|
|
1135
|
+
/** @type {Element[]} hydration claimed nodes */
|
|
1142
1136
|
l = undefined;
|
|
1143
|
-
|
|
1137
|
+
|
|
1138
|
+
constructor(is_svg = false, claimed_nodes) {
|
|
1144
1139
|
super(is_svg);
|
|
1145
1140
|
this.e = this.n = null;
|
|
1146
1141
|
this.l = claimed_nodes;
|
|
@@ -90,12 +90,12 @@ function split_srcset(srcset) {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @param {HTMLSourceElement | HTMLImageElement} element_srcset
|
|
93
|
-
* @param {string} srcset
|
|
93
|
+
* @param {string | undefined | null} srcset
|
|
94
94
|
* @returns {boolean}
|
|
95
95
|
*/
|
|
96
96
|
export function srcset_url_equal(element_srcset, srcset) {
|
|
97
97
|
const element_urls = split_srcset(element_srcset.srcset);
|
|
98
|
-
const urls = split_srcset(srcset);
|
|
98
|
+
const urls = split_srcset(srcset || '');
|
|
99
99
|
|
|
100
100
|
return (
|
|
101
101
|
urls.length === element_urls.length &&
|
package/src/shared/version.js
CHANGED