logo       

Re: getSelectedNode revisited: msg#00001

web.kupu.devel

Subject: Re: getSelectedNode revisited

Hi Guido!


Guido Wesdorp wrote:
yuppie wrote:

4.) The IE version of getSelectedNode doesn't return text nodes, just elements. Either this is a bug or the method should be renamed to getSelectedElement.

It should be renamed, actually returning the element rather than the node (so excluding text nodes) was the behaviour of this method since the very beginning: iow the name has been wrong from the start. However, since that method is used all over the place I don't think it's too smart to change the name now, it will probably break a lot of other code...

I'll add an XXX comment about this to the method(s).


Sounds reasonable. But *if* the behavior of getSelectedNode is defined that way, it does exactly the same as IEs parentElement method does. (For IE TextRange objects getSelectedNode just calls that method.)

So instead of making up another name for this method I guess the best would be to use 'parentElement'.

IESelection and MozillaSelection already have a parentElement method. Maybe we can make getSelectedNode and parentElement aliases for each other?


Regarding implementation details I'll contact you later offlist.

Cheers,

Yuppie


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise