From 692e9fa5010c88dcc01accf777c8751ed8e3ecd5 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Thu, 8 Jul 2010 02:12:49 +0000 Subject: [PATCH] lib MDL-22826 Fixed stylessheet inclusion bug with YUI 3.1.1 and Internet Explorer --- lib/outputrequirementslib.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index d7291e8f84b..53ef6585fd6 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -909,12 +909,16 @@ class page_requirements_manager { // Please note custom CSS is strongly discouraged, // because it can not be overridden by themes! // It is suitable only for things like mod/data which accepts CSS from teachers. + $attributes = array('rel'=>'stylesheet', 'type'=>'text/css'); - $code = ''; - $attributes = array('id'=>'firstthemesheet', 'rel'=>'stylesheet', 'type'=>'text/css'); + // This line of code may look funny but it is currently required in order + // to avoid MASSIVE display issues in Internet Explorer. + // As of IE8 + YUI3.1.1 the reference stylesheet (firstthemesheet) gets + // ignored whenever another resource is added until such time as a redraw + // is forced, usually by moving the mouse over the affected element. + $code = html_writer::tag('script', '/** Required in order to fix style inclusion problems in IE with YUI **/', $attributes+array('id'=>'firstthemesheet')); $urls = $this->cssthemeurls + $this->cssurls; - foreach ($urls as $url) { $attributes['href'] = $url; $code .= html_writer::empty_tag('link', $attributes) . "\n";