D
dino @ wrk
is there a smooth way how to create an MS TextRange object which would
contain only inner content of some
DOM node?
let's say i have a node looking like this...
<div id="myDiv">some text <b>inside</b> div element</div>
....and would like to create a range/textrange which would contain only:
"some text <b>inside</b> div element"
solving this using w3c implementation is rather easy, in which case range
will only span over innerHTML of myDiv:
var range = document.createRange();
range.selectNodeContents(reference_to_myDiv);
however, i'm not able to find the suitable solution for ms/ie
implementation... msdn isn't really helpful either, since the only thing
similar to abovewritten would be using method moveToElementText() of
TextRange object, which again unfortunately returns the range spanned over
whole html of myDiv node, not just the innerHTML.
any suggestions?
contain only inner content of some
DOM node?
let's say i have a node looking like this...
<div id="myDiv">some text <b>inside</b> div element</div>
....and would like to create a range/textrange which would contain only:
"some text <b>inside</b> div element"
solving this using w3c implementation is rather easy, in which case range
will only span over innerHTML of myDiv:
var range = document.createRange();
range.selectNodeContents(reference_to_myDiv);
however, i'm not able to find the suitable solution for ms/ie
implementation... msdn isn't really helpful either, since the only thing
similar to abovewritten would be using method moveToElementText() of
TextRange object, which again unfortunately returns the range spanned over
whole html of myDiv node, not just the innerHTML.
any suggestions?