ripple 0.2.107 → 0.2.109

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.
@@ -3,16 +3,16 @@
3
3
  import { destroy_block, ref } from './blocks.js';
4
4
  import { REF_PROP } from './constants.js';
5
5
  import {
6
- get_descriptors,
7
- get_own_property_symbols,
8
- get_prototype_of,
9
- is_tracked_object,
6
+ get_descriptors,
7
+ get_own_property_symbols,
8
+ get_prototype_of,
9
+ is_tracked_object,
10
10
  } from './utils.js';
11
11
  import { delegate, event } from './events.js';
12
12
  import {
13
- get_attribute_event_name,
14
- is_delegated,
15
- is_event_attribute,
13
+ get_attribute_event_name,
14
+ is_delegated,
15
+ is_event_attribute,
16
16
  } from '../../../utils/events.js';
17
17
  import { get } from './runtime.js';
18
18
  import { clsx } from 'clsx';
@@ -24,14 +24,14 @@ import { normalize_css_property_name } from '../../../utils/normalize_css_proper
24
24
  * @returns {void}
25
25
  */
26
26
  export function set_text(text, value) {
27
- // For objects, we apply string coercion
28
- var str = value == null ? '' : typeof value === 'object' ? value + '' : value;
29
- // @ts-expect-error
30
- if (str !== (text.__t ??= text.nodeValue)) {
31
- // @ts-expect-error
32
- text.__t = str;
33
- text.nodeValue = str + '';
34
- }
27
+ // For objects, we apply string coercion
28
+ var str = value == null ? '' : typeof value === 'object' ? value + '' : value;
29
+ // @ts-expect-error
30
+ if (str !== (text.__t ??= text.nodeValue)) {
31
+ // @ts-expect-error
32
+ text.__t = str;
33
+ text.nodeValue = str + '';
34
+ }
35
35
  }
36
36
 
37
37
  /** @type {Map<string, string[]>} */
@@ -42,29 +42,29 @@ var setters_cache = new Map();
42
42
  * @returns {string[]}
43
43
  */
44
44
  function get_setters(element) {
45
- var setters = setters_cache.get(element.nodeName);
46
- if (setters) return setters;
47
- setters_cache.set(element.nodeName, (setters = []));
48
-
49
- var descriptors;
50
- var proto = element; // In the case of custom elements there might be setters on the instance
51
- var element_proto = Element.prototype;
52
-
53
- // Stop at Element, from there on there's only unnecessary setters we're not interested in
54
- // Do not use constructor.name here as that's unreliable in some browser environments
55
- while (element_proto !== proto) {
56
- descriptors = get_descriptors(proto);
57
-
58
- for (var key in descriptors) {
59
- if (descriptors[key].set) {
60
- setters.push(key);
61
- }
62
- }
45
+ var setters = setters_cache.get(element.nodeName);
46
+ if (setters) return setters;
47
+ setters_cache.set(element.nodeName, (setters = []));
48
+
49
+ var descriptors;
50
+ var proto = element; // In the case of custom elements there might be setters on the instance
51
+ var element_proto = Element.prototype;
52
+
53
+ // Stop at Element, from there on there's only unnecessary setters we're not interested in
54
+ // Do not use constructor.name here as that's unreliable in some browser environments
55
+ while (element_proto !== proto) {
56
+ descriptors = get_descriptors(proto);
57
+
58
+ for (var key in descriptors) {
59
+ if (descriptors[key].set) {
60
+ setters.push(key);
61
+ }
62
+ }
63
63
 
64
- proto = get_prototype_of(proto);
65
- }
64
+ proto = get_prototype_of(proto);
65
+ }
66
66
 
67
- return setters;
67
+ return setters;
68
68
  }
69
69
 
70
70
  /**
@@ -74,25 +74,25 @@ function get_setters(element) {
74
74
  * @returns {void}
75
75
  */
76
76
  export function set_attribute(element, attribute, value) {
77
- // @ts-expect-error
78
- var attributes = (element.__attributes ??= {});
77
+ // @ts-expect-error
78
+ var attributes = (element.__attributes ??= {});
79
79
 
80
- if (attributes[attribute] === (attributes[attribute] = value)) return;
80
+ if (attributes[attribute] === (attributes[attribute] = value)) return;
81
81
 
82
- if (attribute === 'style' && '__styles' in element) {
83
- // reset styles to force style: directive to update
84
- element.__styles = {};
85
- }
82
+ if (attribute === 'style' && '__styles' in element) {
83
+ // reset styles to force style: directive to update
84
+ element.__styles = {};
85
+ }
86
86
 
87
- if (value == null) {
88
- element.removeAttribute(attribute);
89
- } else if (attribute === 'style' && typeof value !== 'string') {
87
+ if (value == null) {
88
+ element.removeAttribute(attribute);
89
+ } else if (attribute === 'style' && typeof value !== 'string') {
90
90
  apply_styles(/** @type {HTMLElement} */ (element), value);
91
91
  } else if (typeof value !== 'string' && get_setters(element).includes(attribute)) {
92
- /** @type {any} */ (element)[attribute] = value;
93
- } else {
94
- element.setAttribute(attribute, value);
95
- }
92
+ /** @type {any} */ (element)[attribute] = value;
93
+ } else {
94
+ element.setAttribute(attribute, value);
95
+ }
96
96
  }
97
97
 
98
98
  /**
@@ -103,7 +103,7 @@ export function apply_styles(element, newStyles) {
103
103
  const style = element.style;
104
104
  const new_properties = new Set();
105
105
 
106
- for(const [property, value] of Object.entries(newStyles)) {
106
+ for (const [property, value] of Object.entries(newStyles)) {
107
107
  const normalized_property = normalize_css_property_name(property);
108
108
  const normalized_value = String(value);
109
109
 
@@ -128,36 +128,63 @@ export function apply_styles(element, newStyles) {
128
128
  * @returns {void}
129
129
  */
130
130
  export function set_attributes(element, attributes) {
131
- for (const key in attributes) {
132
- if (key === 'children') continue;
131
+ let found_enumerable_keys = false;
133
132
 
134
- let value = attributes[key];
133
+ for (const key in attributes) {
134
+ if (key === 'children') continue;
135
+ found_enumerable_keys = true;
135
136
 
136
- if (is_tracked_object(value)) {
137
- value = get(value);
138
- }
137
+ let value = attributes[key];
138
+ if (is_tracked_object(value)) {
139
+ value = get(value);
140
+ }
141
+ set_attribute_helper(element, key, value);
142
+ }
143
+
144
+ // Only if no enumerable keys but attributes object exists
145
+ // This handles spread_props Proxy objects from dynamic elements with {...spread}
146
+ if (!found_enumerable_keys && attributes) {
147
+ const allKeys = Reflect.ownKeys(attributes);
148
+ for (const key of allKeys) {
149
+ if (key === 'children') continue;
150
+ if (typeof key === 'symbol') continue; // Skip symbols - handled by apply_element_spread
151
+
152
+ let value = attributes[key];
153
+ if (is_tracked_object(value)) {
154
+ value = get(value);
155
+ }
156
+ set_attribute_helper(element, key, value);
157
+ }
158
+ }
159
+ }
139
160
 
140
- if (key === 'class') {
141
- const is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';
142
- set_class(/** @type {HTMLElement} */ (element), value, undefined, is_html);
143
- } else if (key === '#class') {
144
- // Special case for static class when spreading props
145
- element.classList.add(value);
146
- } else if (is_event_attribute(key)) {
147
- // Handle event handlers in spread props
148
- const event_name = get_attribute_event_name(key);
149
-
150
- if (is_delegated(event_name)) {
151
- // Use delegation for delegated events
152
- /** @type {any} */ (element)['__' + event_name] = value;
153
- delegate([event_name]);
154
- } else {
155
- // Use addEventListener for non-delegated events
156
- event(event_name, element, value);
157
- }
161
+ /**
162
+ * Helper function to set a single attribute
163
+ * @param {Element} element
164
+ * @param {string} key
165
+ * @param {any} value
166
+ */
167
+ function set_attribute_helper(element, key, value) {
168
+ if (key === 'class') {
169
+ const is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';
170
+ set_class(/** @type {HTMLElement} */ (element), value, undefined, is_html);
171
+ } else if (key === '#class') {
172
+ // Special case for static class when spreading props
173
+ element.classList.add(value);
174
+ } else if (typeof key === 'string' && is_event_attribute(key)) {
175
+ // Handle event handlers in spread props
176
+ const event_name = get_attribute_event_name(key);
177
+
178
+ if (is_delegated(event_name)) {
179
+ // Use delegation for delegated events
180
+ /** @type {any} */ (element)['__' + event_name] = value;
181
+ delegate([event_name]);
158
182
  } else {
159
- set_attribute(element, key, value);
183
+ // Use addEventListener for non-delegated events
184
+ event(event_name, element, value);
160
185
  }
186
+ } else {
187
+ set_attribute(element, key, value);
161
188
  }
162
189
  }
163
190
 
@@ -167,7 +194,7 @@ export function set_attributes(element, attributes) {
167
194
  * @returns {string}
168
195
  */
169
196
  function to_class(value, hash) {
170
- return value == null ? hash ?? '' : clsx([value, hash]);
197
+ return value == null ? (hash ?? '') : clsx([value, hash]);
171
198
  }
172
199
 
173
200
  /**
@@ -178,27 +205,27 @@ function to_class(value, hash) {
178
205
  * @returns {void}
179
206
  */
180
207
  export function set_class(dom, value, hash, is_html = true) {
181
- // @ts-expect-error need to add __className to patched prototype
182
- var prev_class_name = dom.__className;
183
- var next_class_name = to_class(value, hash);
184
-
185
- if (prev_class_name !== next_class_name) {
186
- // Removing the attribute when the value is only an empty string causes
187
- // peformance issues vs simply making the className an empty string. So
188
- // we should only remove the class if the the value is nullish.
189
- if (value == null && !hash) {
190
- dom.removeAttribute('class');
191
- } else {
192
- if (is_html) {
193
- dom.className = next_class_name;
194
- } else {
195
- dom.setAttribute('class', next_class_name);
196
- }
197
- }
208
+ // @ts-expect-error need to add __className to patched prototype
209
+ var prev_class_name = dom.__className;
210
+ var next_class_name = to_class(value, hash);
211
+
212
+ if (prev_class_name !== next_class_name) {
213
+ // Removing the attribute when the value is only an empty string causes
214
+ // peformance issues vs simply making the className an empty string. So
215
+ // we should only remove the class if the the value is nullish.
216
+ if (value == null && !hash) {
217
+ dom.removeAttribute('class');
218
+ } else {
219
+ if (is_html) {
220
+ dom.className = next_class_name;
221
+ } else {
222
+ dom.setAttribute('class', next_class_name);
223
+ }
224
+ }
198
225
 
199
- // @ts-expect-error need to add __className to patched prototype
200
- dom.__className = next_class_name;
201
- }
226
+ // @ts-expect-error need to add __className to patched prototype
227
+ dom.__className = next_class_name;
228
+ }
202
229
  }
203
230
 
204
231
  /**
@@ -207,21 +234,21 @@ export function set_class(dom, value, hash, is_html = true) {
207
234
  * @returns {void}
208
235
  */
209
236
  export function set_value(element, value) {
210
- // @ts-expect-error
211
- var attributes = (element.__attributes ??= {});
212
-
213
- if (
214
- attributes.value ===
215
- (attributes.value =
216
- // treat null and undefined the same for the initial value
217
- value ?? undefined) ||
218
- // `progress` elements always need their value set when it's `0`
219
- (element.value === value && (value !== 0 || element.nodeName !== 'PROGRESS'))
220
- ) {
221
- return;
222
- }
237
+ // @ts-expect-error
238
+ var attributes = (element.__attributes ??= {});
239
+
240
+ if (
241
+ attributes.value ===
242
+ (attributes.value =
243
+ // treat null and undefined the same for the initial value
244
+ value ?? undefined) ||
245
+ // `progress` elements always need their value set when it's `0`
246
+ (element.value === value && (value !== 0 || element.nodeName !== 'PROGRESS'))
247
+ ) {
248
+ return;
249
+ }
223
250
 
224
- element.value = value ?? '';
251
+ element.value = value ?? '';
225
252
  }
226
253
 
227
254
  /**
@@ -230,19 +257,19 @@ export function set_value(element, value) {
230
257
  * @returns {void}
231
258
  */
232
259
  export function set_checked(element, checked) {
233
- // @ts-expect-error
234
- var attributes = (element.__attributes ??= {});
235
-
236
- if (
237
- attributes.checked ===
238
- (attributes.checked =
239
- // treat null and undefined the same for the initial value
240
- checked ?? undefined)
241
- ) {
242
- return;
243
- }
260
+ // @ts-expect-error
261
+ var attributes = (element.__attributes ??= {});
262
+
263
+ if (
264
+ attributes.checked ===
265
+ (attributes.checked =
266
+ // treat null and undefined the same for the initial value
267
+ checked ?? undefined)
268
+ ) {
269
+ return;
270
+ }
244
271
 
245
- element.checked = checked;
272
+ element.checked = checked;
246
273
  }
247
274
 
248
275
  /**
@@ -251,15 +278,15 @@ export function set_checked(element, checked) {
251
278
  * @returns {void}
252
279
  */
253
280
  export function set_selected(element, selected) {
254
- if (selected) {
255
- // The selected option could've changed via user selection, and
256
- // setting the value without this check would set it back.
257
- if (!element.hasAttribute('selected')) {
258
- element.setAttribute('selected', '');
259
- }
260
- } else {
261
- element.removeAttribute('selected');
262
- }
281
+ if (selected) {
282
+ // The selected option could've changed via user selection, and
283
+ // setting the value without this check would set it back.
284
+ if (!element.hasAttribute('selected')) {
285
+ element.setAttribute('selected', '');
286
+ }
287
+ } else {
288
+ element.removeAttribute('selected');
289
+ }
263
290
  }
264
291
 
265
292
  /**
@@ -268,35 +295,35 @@ export function set_selected(element, selected) {
268
295
  * @returns {() => void}
269
296
  */
270
297
  export function apply_element_spread(element, fn) {
271
- /** @type {Record<string | symbol, any> | undefined} */
272
- var prev;
273
- /** @type {Record<symbol, Block>} */
274
- var effects = {};
275
-
276
- return () => {
277
- var next = fn();
278
-
279
- for (let symbol of get_own_property_symbols(effects)) {
280
- if (!next[symbol]) {
281
- destroy_block(effects[symbol]);
282
- }
283
- }
298
+ /** @type {Record<string | symbol, any> | undefined} */
299
+ var prev;
300
+ /** @type {Record<symbol, Block>} */
301
+ var effects = {};
302
+
303
+ return () => {
304
+ var next = fn();
305
+
306
+ for (let symbol of get_own_property_symbols(effects)) {
307
+ if (!next[symbol]) {
308
+ destroy_block(effects[symbol]);
309
+ }
310
+ }
284
311
 
285
- for (const symbol of get_own_property_symbols(next)) {
286
- var ref_fn = next[symbol];
312
+ for (const symbol of get_own_property_symbols(next)) {
313
+ var ref_fn = next[symbol];
287
314
 
288
- if (symbol.description === REF_PROP && (!prev || ref_fn !== prev[symbol])) {
289
- if (effects[symbol]) {
290
- destroy_block(effects[symbol]);
291
- }
292
- effects[symbol] = ref(element, () => ref_fn);
293
- }
315
+ if (symbol.description === REF_PROP && (!prev || ref_fn !== prev[symbol])) {
316
+ if (effects[symbol]) {
317
+ destroy_block(effects[symbol]);
318
+ }
319
+ effects[symbol] = ref(element, () => ref_fn);
320
+ }
294
321
 
295
- next[symbol] = ref_fn;
296
- }
322
+ next[symbol] = ref_fn;
323
+ }
297
324
 
298
- set_attributes(element, next);
325
+ set_attributes(element, next);
299
326
 
300
- prev = next;
301
- };
327
+ prev = next;
328
+ };
302
329
  }
@@ -412,7 +412,7 @@ function is_tracking_dirty(tracking) {
412
412
  var tracked = tracking.t;
413
413
 
414
414
  if ((tracked.f & DERIVED) !== 0) {
415
- update_derived(/** @type {Derived} **/(tracked));
415
+ update_derived(/** @type {Derived} **/ (tracked));
416
416
  }
417
417
 
418
418
  if (tracked.c > tracking.c) {
@@ -472,7 +472,7 @@ export function async_computed(fn, block) {
472
472
  }
473
473
 
474
474
  promise.then((v) => {
475
- if (parent && is_destroyed(/** @type {Block} */(parent))) {
475
+ if (parent && is_destroyed(/** @type {Block} */ (parent))) {
476
476
  return;
477
477
  }
478
478
  if (promise === current && t.v !== v) {
@@ -746,7 +746,7 @@ export function get(tracked) {
746
746
  }
747
747
 
748
748
  return (tracked.f & DERIVED) !== 0
749
- ? get_derived(/** @type {Derived} */(tracked))
749
+ ? get_derived(/** @type {Derived} */ (tracked))
750
750
  : get_tracked(tracked);
751
751
  }
752
752
 
@@ -775,7 +775,9 @@ export function get_tracked(tracked) {
775
775
  */
776
776
  export function set(tracked, value, block) {
777
777
  if (!is_mutating_allowed) {
778
- throw new Error('Assignments or updates to tracked values are not allowed during computed "track(() => ...)" evaluation');
778
+ throw new Error(
779
+ 'Assignments or updates to tracked values are not allowed during computed "track(() => ...)" evaluation',
780
+ );
779
781
  }
780
782
 
781
783
  var old_value = tracked.v;
@@ -1152,7 +1154,7 @@ export async function maybe_tracked(v) {
1152
1154
  } else {
1153
1155
  value = await async_computed(async () => {
1154
1156
  return await get_tracked(v);
1155
- }, /** @type {Block} */(active_block));
1157
+ }, /** @type {Block} */ (active_block));
1156
1158
  }
1157
1159
  } else {
1158
1160
  value = await v;
@@ -1,10 +1,10 @@
1
1
  /** @import { Block } from '#client' */
2
2
 
3
3
  import {
4
- TEMPLATE_FRAGMENT,
5
- TEMPLATE_USE_IMPORT_NODE,
6
- TEMPLATE_SVG_NAMESPACE,
7
- TEMPLATE_MATHML_NAMESPACE,
4
+ TEMPLATE_FRAGMENT,
5
+ TEMPLATE_USE_IMPORT_NODE,
6
+ TEMPLATE_SVG_NAMESPACE,
7
+ TEMPLATE_MATHML_NAMESPACE,
8
8
  } from '../../../constants.js';
9
9
  import { first_child, is_firefox } from './operations.js';
10
10
  import { active_block } from './runtime.js';
@@ -15,17 +15,17 @@ import { active_block } from './runtime.js';
15
15
  * @param {Node} end - The end node.
16
16
  */
17
17
  export function assign_nodes(start, end) {
18
- var block = /** @type {Block} */ (active_block);
19
- var s = block.s;
20
- if (s === null) {
21
- block.s = {
22
- start,
23
- end,
24
- };
25
- } else if (s.start === null) {
26
- s.start = start;
27
- s.end = end;
28
- }
18
+ var block = /** @type {Block} */ (active_block);
19
+ var s = block.s;
20
+ if (s === null) {
21
+ block.s = {
22
+ start,
23
+ end,
24
+ };
25
+ } else if (s.start === null) {
26
+ s.start = start;
27
+ s.end = end;
28
+ }
29
29
  }
30
30
 
31
31
  /**
@@ -35,16 +35,20 @@ export function assign_nodes(start, end) {
35
35
  * @param {boolean} use_mathml_namespace - Whether to use MathML namespace.
36
36
  * @returns {DocumentFragment}
37
37
  */
38
- export function create_fragment_from_html(html, use_svg_namespace = false, use_mathml_namespace = false) {
39
- if (use_svg_namespace) {
40
- return from_namespace(html, 'svg');
41
- }
42
- if (use_mathml_namespace) {
43
- return from_namespace(html, 'math');
44
- }
45
- var elem = document.createElement('template');
46
- elem.innerHTML = html;
47
- return elem.content;
38
+ export function create_fragment_from_html(
39
+ html,
40
+ use_svg_namespace = false,
41
+ use_mathml_namespace = false,
42
+ ) {
43
+ if (use_svg_namespace) {
44
+ return from_namespace(html, 'svg');
45
+ }
46
+ if (use_mathml_namespace) {
47
+ return from_namespace(html, 'math');
48
+ }
49
+ var elem = document.createElement('template');
50
+ elem.innerHTML = html;
51
+ return elem.content;
48
52
  }
49
53
 
50
54
  /**
@@ -54,38 +58,40 @@ export function create_fragment_from_html(html, use_svg_namespace = false, use_m
54
58
  * @returns {() => Node}
55
59
  */
56
60
  export function template(content, flags) {
57
- var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;
58
- var use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;
59
- var use_svg_namespace = (flags & TEMPLATE_SVG_NAMESPACE) !== 0;
60
- var use_mathml_namespace = (flags & TEMPLATE_MATHML_NAMESPACE) !== 0;
61
- /** @type {Node | DocumentFragment | undefined} */
62
- var node;
63
- var has_start = !content.startsWith('<!>');
61
+ var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;
62
+ var use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;
63
+ var use_svg_namespace = (flags & TEMPLATE_SVG_NAMESPACE) !== 0;
64
+ var use_mathml_namespace = (flags & TEMPLATE_MATHML_NAMESPACE) !== 0;
65
+ /** @type {Node | DocumentFragment | undefined} */
66
+ var node;
67
+ var has_start = !content.startsWith('<!>');
64
68
 
65
- return () => {
66
- if (node === undefined) {
67
- node = create_fragment_from_html(
68
- has_start ? content : '<!>' + content,
69
- use_svg_namespace,
70
- use_mathml_namespace,
71
- );
72
- if (!is_fragment) node = /** @type {Node} */ (first_child(node));
73
- }
69
+ return () => {
70
+ if (node === undefined) {
71
+ node = create_fragment_from_html(
72
+ has_start ? content : '<!>' + content,
73
+ use_svg_namespace,
74
+ use_mathml_namespace,
75
+ );
76
+ if (!is_fragment) node = /** @type {Node} */ (first_child(node));
77
+ }
74
78
 
75
- var clone =
76
- use_import_node || is_firefox ? document.importNode(/** @type {Node} */ (node), true) : /** @type {Node} */ (node).cloneNode(true);
79
+ var clone =
80
+ use_import_node || is_firefox
81
+ ? document.importNode(/** @type {Node} */ (node), true)
82
+ : /** @type {Node} */ (node).cloneNode(true);
77
83
 
78
- if (is_fragment) {
79
- var start = first_child(clone);
80
- var end = clone.lastChild;
84
+ if (is_fragment) {
85
+ var start = first_child(clone);
86
+ var end = clone.lastChild;
81
87
 
82
- assign_nodes(/** @type {Node} */ (start), /** @type {Node} */ (end));
83
- } else {
84
- assign_nodes(clone, clone);
85
- }
88
+ assign_nodes(/** @type {Node} */ (start), /** @type {Node} */ (end));
89
+ } else {
90
+ assign_nodes(clone, clone);
91
+ }
86
92
 
87
- return clone;
88
- };
93
+ return clone;
94
+ };
89
95
  }
90
96
 
91
97
  /**
@@ -94,7 +100,7 @@ export function template(content, flags) {
94
100
  * @param {Node} dom - The DOM node to append.
95
101
  */
96
102
  export function append(anchor, dom) {
97
- anchor.before(/** @type {Node} */ (dom));
103
+ anchor.before(/** @type {Node} */ (dom));
98
104
  }
99
105
 
100
106
  /**
@@ -104,18 +110,18 @@ export function append(anchor, dom) {
104
110
  * @returns {DocumentFragment}
105
111
  */
106
112
  function from_namespace(content, ns = 'svg') {
107
- var wrapped = `<${ns}>${content}</${ns}>`;
113
+ var wrapped = `<${ns}>${content}</${ns}>`;
108
114
 
109
- var elem = document.createElement('template');
110
- elem.innerHTML = wrapped;
111
- var fragment = elem.content;
115
+ var elem = document.createElement('template');
116
+ elem.innerHTML = wrapped;
117
+ var fragment = elem.content;
112
118
 
113
- var root = /** @type {Element} */ (first_child(fragment));
114
- var result = document.createDocumentFragment();
119
+ var root = /** @type {Element} */ (first_child(fragment));
120
+ var result = document.createDocumentFragment();
115
121
 
116
- while (first_child(root)) {
117
- result.appendChild(/** @type {Node} */ (first_child(root)));
118
- }
122
+ while (first_child(root)) {
123
+ result.appendChild(/** @type {Node} */ (first_child(root)));
124
+ }
119
125
 
120
- return result;
126
+ return result;
121
127
  }