IE javacript DOM issue (Ajax)

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
7/16/2008 12:25:36 PM
Gravatar
Total Posts 1

IE javacript DOM issue (Ajax)

Hi all,

I use the following function in my Ajax application:
Utilities.createElement = function(e, obj)

var element = document.createElement(e);
for (prop in obj)
{
element[prop] = obj[prop];;
}
return element;
}

In one section of the application, I am creating a 'td' element, and the obj is JSON code with attributes not typically found in a td. These attributes are recalled by further functions, so that I can access table cells based on record numbers. The code in question is below:
this.sessionDiv = Utilities.createElement("td", {
id: studio + recordNumber,
recordNumber: recordNumber,
studio: studio,
className: classname,
innerHTML: innerHTML,
sessionArrayElement: x
});


Works great in all browsers except any version of IE. The error occurs in the createElement function and the error returned is "object doesn't support this action". What's odd, is that when createElement is called with an 'a' tag and the same attributes, it works fine in IE. So far the 'td' cell tag is the only thing that this errors out. If I remove the recordNumber, sessionArrayElement and studio attributes, the function does not error out.

I hope I explained this well enough. I've google'd this issue extensively but can't find explanations for this....anyone out there have any ideas?

Thanks,

 

___________________________

[url=http://www.insurancebyjohn.com]renter insurance california[/url] [url=http://www.space2.com]bedroom furniture[/url]
 

7/17/2008 11:16:04 AM
Gravatar
Total Posts 18439

Re: IE javacript DOM issue (Ajax)

Hi,

I think its not a good idea to render invalid markup using javascript by making up your own expando prooperties for html elements. Sounds like IE is doing the right thing and enforcing this while other browsers are forgiving and allowing you to do the wrong thing. If you need to store extra properties store them on your javascript objects not on made up arbitrary attributes on the html elements. Seems like you could associate your json objects to an element by an id or naming convention but keep the custom properties on the json object not on the html element.

javascript can write almost anything into the markup using document.write, but just because you can write invlaid stuff doesn't mean you should. With dom scripting I think the browser "should" enforce the rules of the dom and it sounds like IE is correctly enforcing it.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.