I have a fragment of HTML that I am inserting into an UL using $ 
('element_id').insert().

var copy = '<li class="copy" id="' + elm.id + '-' + elm.copies +  
'"><img src="Resources/drag.png" width="16" height="16" alt=""  
class="handle" /> Caption: <input type="text" class="caption" value="'  
+ elm.innerHTML + '" /> Start: <input type="text" class="timecode" />  
Stop: <input type="text" class="timecode" /> <img src="icns/ 
comment_add.png" width="16" height="16" class="addCaption" alt=""  
title="Add Caption" /> <img src="icns/delete_gray.png" class="remove"  
width="16" height="16" alt="[x]" title="Remove" /></li>';

If I change this one part:

id="' + elm.id + '-' + elm.copies + '"

to

id="' + elm.id + '.' + elm.copies + '"

(creating an ID with a dot in it rather than a hyphen) then I get the  
following error:

SYNTAX_ERR: DOM Exception 12
http://ajax.googleapis.com/ajax/libs/prototype/1.6/prototype.js (line  
2844)

...in Safari 3.2.1.

I have also tried creating the DOM element with new Element() syntax,  
and have the same problem there. With the dash, it works fine.

This code works perfectly in Firefox 2 with either the dot or the  
dash, haven't tested it elsewhere.

I though perhaps the dot was illegal in an ID, but I just looked it up  
on W3, and it is allowed anywhere after the first character.

Can anyone suggest a reason why this is happening? Does anyone know  
what a DOM Exception 12 might mean?

Thanks in advance,

Walter

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to