[Prototype-core] Re: new swap method for elements

2008-09-24 Thread John-David Dalton
Thanx Diego. Those are some good unit test ideas and will effect the outcome of the method definition. I did a little searching and a small test on IE. It appears IE doesn't let you transfer an element from one document to another. Other browsers do via `document.importNode` http://www.w3.org/TR

[Prototype-core] Re: new swap method for elements

2008-09-24 Thread Diego Perini
JDD, didn't want to rise extra issues, your code and the lazy initialization are perfect and fast, but if I remember correctly I preferred to leave out native IE "swapNode" because it was impossible to do swaps between DOM nodes of different contexts (documents), but I may recall it wrong ! In th

[Prototype-core] Re: new swap method for elements

2008-09-23 Thread John-David Dalton
@Kangax I am not aware of any issues with insertBefore and table elements. I know that IE has issues with innerHTML and table/select elements. @EMoreth if nextSibling is null insertBefore will act as appendChild so it should still work out. http://developer.mozilla.org/en/DOM/element.insertBefor

[Prototype-core] Re: new swap method for elements

2008-09-23 Thread Simon Charette
Using native IE method (swapNode) might help for weird issues in table. http://msdn.microsoft.com/en-us/library/ms536774(VS.85).aspx if (element.swapNode) return element.swapNode(secondElement); 2008/9/23 EMoreth <[EMAIL PROTECTED]> > > Shouldnt it use the parent node of both elements ?? > > Ca

[Prototype-core] Re: new swap method for elements

2008-09-23 Thread EMoreth
Shouldnt it use the parent node of both elements ?? Cause if i decide to swap 'div1' and 'div2' here ill have no nextSibling (assuming that no textNodes would be returned as siblings)... EMoreth On Sep 23, 5:04 pm, kangax <[EMAIL PROTECTED]> wrote: > On Sep 23,

[Prototype-core] Re: new swap method for elements

2008-09-23 Thread kangax
On Sep 23, 11:25 am, John-David Dalton <[EMAIL PROTECTED]> wrote: > @Tag can you provide a case where this would be a real issue ? > I can't see someone swapping nodes with the document.documentElement > or anything. I think `Element.replace` is a good way to ensure no cross-browser bugs crawl in

[Prototype-core] Re: new swap method for elements

2008-09-23 Thread John-David Dalton
@Tag can you provide a case where this would be a real issue ? I can't see someone swapping nodes with the document.documentElement or anything. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group

[Prototype-core] Re: new swap method for elements

2008-09-23 Thread Tom Gregory
Perhaps you intend it, but you're assuming both nodes exist in a DOM fragment (and are not the root node of the fragment). I realize this scenario may be best handled by the developer's use of Element.replace instead, but perhaps some error checking will help avoid confusion. TAG On Sep

[Prototype-core] Re: new swap method for elements

2008-09-23 Thread John-David Dalton
Awesome use of nextSibling and parentNode! I have added my version which checks for the existence of the element.swapNode method (in IE). You can find it posted in the ticket. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G