Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 10973c3

Browse files
committedJul 9, 2018
fix($compile): work around Firefox DocumentFragment bug
DOM nodes passed to `compilationGenerator()` will eventually be wrapped in `jqLite`, when the compilation actually happens. In Firefox 60+, there seems to be a `DocumentFragment`-related bug that sometimes causes the `childNodes` to be empty at the time the compilation happens. This commit works around this bug by eagerly wrapping `childNodes` in `jqLite`. NOTE: The wrapped nodes have references to their `DocumentFragment` container. This is "by design", since we want to be able to traverse the nodes via `nextSibling` (in order to correctly handle multi-element directives). Once the nodes are compiled, they will be either moved to a new container element or the `jqLite` wrapper is release making them eligible for garbage collection. In both cases, the original `DocumentFragment` container should be eligible for garbage collection too. Fixes #16607 Closes #16615
1 parent fc64e68 commit 10973c3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/ng/compile.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2619,11 +2619,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
26192619
for (var slotName in slots) {
26202620
if (slots[slotName]) {
26212621
// Only define a transclusion function if the slot was filled
2622-
slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName].childNodes, transcludeFn);
2622+
var slotCompileNodes = jqLite(slots[slotName].childNodes);
2623+
slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slotCompileNodes, transcludeFn);
26232624
}
26242625
}
26252626

2626-
$template = $template.childNodes;
2627+
$template = jqLite($template.childNodes);
26272628
}
26282629

26292630
$compileNode.empty(); // clear contents

0 commit comments

Comments
 (0)
This repository has been archived.