Until recently, I used Safari 4 to test and debug my current jQuery plugin. I tried my code in Firefox and he started complaining about something in the JQuery-Framework: "setting a property that only has a getter." I tried to figure out which line makes Firefox complain and found that this is happening somewhere here **
$.fn.util.create_$dom = function(opt) {
var $dom = {};
$.each(opt.dom,function(name,val){
console.log(name);
var $elm = $('<div>');
$.each(opt.dom[name],function(_name,_val){
if(_name == 'tagName') $elm = $('<'+_val+'/>');
});
console.log(name+': ok');
$.each(opt.dom[name],function(_name,_val){ **here
switch(_name){ **here
case 'className': $elm.addClass(_val); **here
default: $elm.attr(_name, _val); **here
} **here
});
$dom[name] = $elm;
console.log(name+': ok');
});
return $dom;
};
options.dom looks like this:
dom:{
wrapper:{className:'wrapper'},
inner:{tagName:'p',className:'test',test:'bla'}
},
source
share