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
This commit is contained in:
Nicolas Grekas 2015-08-25 18:19:32 +02:00
commit de7b255871
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ var refStyle = doc.createElement('style'),
e.addEventListener(n, cb, false);
};
doc.documentElement.firstChild.appendChild(refStyle);
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
if (!doc.addEventListener) {
addEventListener = function (element, eventName, callback) {