8000 bug #15493 [VarDumper] fixed HtmlDumper to target specific the head t… · symfony/symfony@de7b255 · GitHub
[go: up one dir, main page]

Skip to content

Commit de7b255

Browse files
bug #15493 [VarDumper] fixed HtmlDumper to target specific the head tag (SaschaDens)
This PR was submitted for the 2.6 branch but it was merged into the 2.7 branch instead (closes #15493). Discussion ---------- [VarDumper] fixed HtmlDumper to target specific the head tag | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - On our webportals we faced the issue that we received the following js error: `Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': This node type does not support this method.` and then the full dump is displaying without the arrows to collapse. To simulate this error I've created a [Gist](https://gist.github.com/SaschaDens/0c5cc610ba168f6206d2) and as reference used [Adventures With document.documentElement.firstChild](https://robert.accettura.com/blog/2009/12/12/adventures-with-document-documentelement-firstchild/) This PR specifically targets the head by using `document.getElementsByTagName('head')[0]` instead of `document.documentElement.firstChild` Commits ------- cbba074 [VarDumper] fixed HtmlDumper to target specific the head tag
2 parents ffdab92 + cbba074 commit de7b255

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function getDumpHeader()
129129
e.addEventListener(n, cb, false);
130130
};
131131
132-
doc.documentElement.firstChild.appendChild(refStyle);
132+
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
133133
134134
if (!doc.addEventListener) {
135135
addEventListener = function (element, eventName, callback) {

0 commit comments

Comments
 (0)
0