Prototype.js 1.6 new element class and IE> = 9
Then I try to create a new item like
new Element('div',{'class':'name'});
all browsers create a new element with the class name. But in Internet Explorer 9 and 10 I have this
<div className="name"></div>
As you can see, a className attribute is created instead of a class. How can I fix this?
source to share
//This generates 'className':
var popoutControl = new Element('div', {'class':'mySuperCoolClassName'});
// Break the line up into two lines.
// The following will generate a 'class' attribute instead:
var popoutControl = new Element('div');
popoutControl.className = 'mySuperCoolClassName';
source to share
replace
new Element('div',{'class':'name'});
from
var mydiv = new Element('div');
mydiv.addClassName('name');
As suggested by http://prototypejs.org/api/element/classNames Element. Class name ('name'); is deprecated and you must use Element. addClassName ().
source to share
Please see my answer here:
fooobar.com/questions/1899256 / ...
Basically, prototype 1.6 doesn't work in these versions of IE. You should update Prototype. the problem is in the list of translations contained in Element._attributeTranslations.write
This is the list in prototype 1.7 (and up I suppose)
I am assuming it worked in older versions of IE (this was probably the case before IE9).
source to share