From 4817394a2c2f7f03996434277c4a8affff9b962c Mon Sep 17 00:00:00 2001 From: air2 Date: Tue, 6 May 2014 13:14:04 +0200 Subject: [PATCH] className support for IE < 8 in Bar.js The className must not set thru the setAttribute on IE < 8. Else the css associated with this class is not properly applied to the node. See also: http://stackoverflow.com/questions/5406301/ie7-how-to-set-the-class-attribute-for-a-dynamically-created-element-in-javas --- modules/Bar.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/Bar.js b/modules/Bar.js index 3d23b66d2..34974c71e 100644 --- a/modules/Bar.js +++ b/modules/Bar.js @@ -3,11 +3,12 @@ define([ "dojo/_base/declare", "dojo/_base/lang", "dojo/_base/array", + "dojo/has", "dijit/registry", "dijit/a11y", "dojo/dom-construct", "../core/_Module" -], function(require, declare, lang, array, registry, a11y, domConstruct, _Module){ +], function(require, declare, lang, array, has, registry, a11y, domConstruct, _Module){ /*===== var Bar = declare(_Module, { @@ -200,8 +201,13 @@ define([ tbody = domConstruct.create('tbody'), setAttr = function(n, def, domAttr, attr){ if(def[attr]){ - n.setAttribute(domAttr || attr, def[attr]); - delete def[attr]; + //fixes problems where IE 7 & 6 do not apply the css for the specified class. + //see http://stackoverflow.com/questions/5406301/ie7-how-to-set-the-class-attribute-for-a-dynamically-created-element-in-javas + if ((has("ie") < 8) && attr == 'className') { + n.className = def[attr]; + } else { + n.setAttribute(domAttr || attr, def[attr]); + }; } }; for(var i = 0, rowCount = defs.length; i < rowCount; ++i){