Cannot create element with a class, reserved keyword.
Reported by deanoj | October 13th, 2010 @ 08:56 AM
A fixed version of your function, using cls to set the 'class' attribute.
var Element = function(type, atts, content) {
this.el = document.createElement(type);
for(var attr in atts) {
if (attr == 'cls') {
this.el.setAttribute('class', atts[attr]);
} else {
this.el.setAttribute(attr, atts[attr]);
}
}
this.el.innerHTML = content || '';
return this.el;
};
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
baseJS is a lightweight Javascript framework intended for use with Mobile Safari on the iPhone and iPod Touch; it also
works with Firefox and all WebKit-based browsers. By providing shortcuts and reusable methods, baseJS helps you write
code to be lightweight and extendable—perfect for the mobile web.