Safari Dom Exception 5 - setAttribute() gotcha

I just hit up against a little gotcha with the Safari browser for Apple.  People had been complaining they couldn't comment on our blogs from Safari and I was pulling my hair out trying to figure out why.  After a VNC session with a Safari browser, finally got to the bottom of it.  (thank you Andy for lending me your Mini!)

If you are setting custom attributes on a DOM object, then Safari doesn't like them starting with an (_) underscore.

So instead:

    div.setAttribute( "_contentloaded", "1" );

change to: 

    div.setAttribute( "contentloaded", "1" );

Interestingly though, it is more than happy to read attributes beginning with an underscore if already present in the DOM, just coughs with a very descriptive "Dom Exception 5" error.  Because it was reading the attributes fine enough, it took a little debugging to find this one. 


Recent Cloud posts

Recent JAVA posts

Latest CFML posts

Site Links