views:

250

answers:

1

I have a selection object where in IE, I run

range = selection.createRange();

I then try to get the startContainer but am unable to figure out how. All examples show me SETTING the startContainer, but I am basing this off highlighting text. How do I know which element to set it to without getting it first?

I know in FireFox it's as simple as

range     = selection.getRangeAt(0);
firstNode = range.startContainer;
A: 

I'm also working on something similar. I haven't gotten to the IE part just yet, but I would suggest iterating through the list of properties of range and see what's available to you

var msg = '';
for (var i in range) {
    msg += i + ': ' + range[i] + '\n';
}
alert(msg);
MK_Dev