findText() within itemByRange(): strange behavior
Hi,
I'm a little bit stuck with this:
var myScope = myDoc.selection[0].parentStory.characters.itemByRange(start,end); // at this stage, start is first character of Story and end is last one
var myFoundCharas = myScope.findText(); // find some text
alert(myScope.constructor.name); // gives "character", ok
alert(myFoundCharas.constructor.name); // gives "array" made of a mix of "word" "character" "textStyleRange"..., ok
alert(myFoundCharas[0].constructor.name); // gives "array" made of a mix of "word" "character" "textStyleRange"... ?!!!!? why not just "word"
alert(myFoundCharas[0][0].constructor.name); // gives "word"
If I change myScope to be the entire Story it gives the normal behavior:
var myScope = myDoc.selection[0].parentStory; // no more itemByRange
var myFoundCharas = myScope.findText(); // find some text
alert(myScope.constructor.name); // gives "story", ok
alert(myFoundCharas.constructor.name); // gives "array" made of a mix of "word" "character" "textStyleRange"..., ok
alert(myFoundCharas[0].constructor.name); // gives "word", ok
Any idea to explain this would be welcome?
Thanks