Re: [svg-developers] node from id

2005-10-17 Thread osaka minami
well i just found document.getElementById('myItemId').parentNode.removeChild(document.getElementById('myItemId)); that's a wired logic... maiko hi, i am wondering what the quickest way is to get a node reference out of an element accessed by .getElementById(), let's say i want handle myItem

Re: [svg-developers] node from id

2005-10-17 Thread Jonathan Watt
Hi maiko, JavaScript isn't a strongly typed language, so you don't have to cast or anything like that. You just use the interface you need: var myItem = document.getElementById('myItemId'); myItem.removeChild(...); -Jonathan On 10/17/05, osaka minami [EMAIL PROTECTED] wrote: hi, i am

Re: [svg-developers] node from id

2005-10-17 Thread Jonathan Watt
On 10/17/05, osaka minami [EMAIL PROTECTED] wrote: well i just found document.getElementById('myItemId').parentNode.removeChild( document.getElementById('myItemId)); Ah, I see. I hadn't understood it was the parent node you wanted. that's a wired logic... maiko hi, i am wondering

RE: [svg-developers] node from id

2005-10-17 Thread Doug Schepers
Hi, Maiko- If you're looking for the most optimized way, do it like this: var myItem = doc.getElementById('myItem'); myItem.parentNode.removeChild(myItem); That way, you're only hitting the DOM to find the element once, instead of twice. gEBI is a rather expensive method call, I would think,

RE: [svg-developers] node from id

2005-10-17 Thread david dailey
At 08:24 AM 10/17/2005, Doug wrote: That way, you're only hitting the DOM to find the element once, instead of twice. gEBI is a rather expensive method call, I would think, especially on large documents (unless the implementation caches a hash table of all the ids). Interesting -- I would take

Re: [svg-developers] node from id

2005-10-17 Thread Jonathan Watt
On 10/17/05, david dailey [EMAIL PROTECTED] wrote: At 08:24 AM 10/17/2005, Doug wrote: That way, you're only hitting the DOM to find the element once, instead of twice. gEBI is a rather expensive method call, I would think, especially on large documents (unless the implementation caches a

RE: [svg-developers] node from id

2005-10-17 Thread Doug Schepers
Hi, David- | At 08:24 AM 10/17/2005, Doug wrote: | That way, you're only hitting the DOM to find the element | once, instead | of twice. gEBI is a rather expensive method call, I would think, | especially on large documents (unless the implementation | caches a hash | table of all the ids).

Re: [svg-developers] node from id

2005-10-17 Thread Jeff Rafter
Mozilla maintains a hash table. I'd imagine most other browsers would do the same, but I could be wrong. Agreed. Another important point is this: because all of the implementations do silly stuff like maintain a hash table you can get into trouble with IDs. Supposedly the DTD has to be in