Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.preload.js

Issue 9426117: Topic 10770 - Work around breaking dev tools functionality (Chrome issue 178109) (Closed)
Patch Set: Created Feb. 25, 2013, 3:33 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -25,17 +25,21 @@ function setElemhideCSSRules(selectors)
if (elemhideElt && elemhideElt.parentNode)
elemhideElt.parentNode.removeChild(elemhideElt);
if (!selectors)
return;
elemhideElt = document.createElement("style");
elemhideElt.setAttribute("type", "text/css");
- document.documentElement.appendChild(elemhideElt);
+
+ // Try to insert the style into the <head> tag, inserting directly under the
+ // document root breaks dev tools functionality:
+ // http://code.google.com/p/chromium/issues/detail?id=178109
+ (document.head || document.documentElement).appendChild(elemhideElt);
var elt = elemhideElt; // Use a local variable to avoid racing conditions
function setRules()
{
if (!elt.sheet)
{
// Stylesheet didn't initialize yet, wait a little longer
window.setTimeout(setRules, 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld