Let's say I want to get the paragraph containing the caret. I might have:
var node = window.getSelection().getRangeAt(0).startContainer;
// node is either Element or Text
var para = (Object.isElement( node ) ?
$(node).up( 'p' )
: $(node.parentNode).up( 'p' ));
So in the above I'm forced to go up the tree in two different ways
(.parentNode and .up). If Element#up were Node#up, this could be simplified
var para = $(window.getSelection().getRangeAt(0).startContainer).up('p');
Generally, Prototype's policy of ignoring non-Element Nodes makes things
simpler but there are times interacting with the browser when you have to deal
with it giving you TextNodes and suddenly you're back to using standard DOM
Off the top of my head, some of the Element methods that could be provided for
This wouldn't break compatibility because all the Element methods would behave
the same as before.
my wiki ajaxification thing: http://wikizzle.org
my blog: http://jimhigson.blogspot.com/
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to firstname.lastname@example.org
To unsubscribe from this group, send email to
For more options, visit this group at