Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Issue with adding self closing Elements

#1

Was using your excellent foundation this morning on a mobile site we are working on. Found that it returns a 'NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7' on selfclosing elements in WebKit @ least e.g.:

el.appendChild(new Element('img', {'src':'/images/vehicle-search/soldflaglist.gif','class':'soldflag'}));

The following fix to Element method seems to fix he issue:

/* * Simplified element creation function * @param type {string} The type of element to create. * @param atts {object} Attributes to attached to the HTMLElement. (optional) * @param content {string} Set the innerHTML of the element. (optional) / var Element = function(type, atts, content) {

this.el = document.createElement(type);

for(var attr in atts) {
    this.el.setAttribute(attr, atts[attr]);
}
if (!(/(area|base|basefont|br|hr|img|input|link|meta)/).test(type)) //ND - added this line to filter self closing
this.el.innerHTML = content || '';
return this.el;

};

Reported by Nick Donald · May 16th, 2010 @ 06:14 AM

State: new
Milestone: none
Assigned to: nobody

Activity

No comments yet.

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.