2 Replies Latest reply on Mar 14, 2014 10:47 AM by LeftHead

    Riddle: xml tag markers and text length




      Can someone explain this:


      If I select 1 character from my content and run this script


      var myText = app.selection[0];

      alert(myText.length); // return "1"

      app.activeDocument.xmlElements[0].xmlElements.add({markupTag:"i", xmlContent:myText});

      alert(myText.length); // return "2"


      I could understand to have "1" and "3" if both tag markers are inserted inside the selection or "1" and "1" if both inserted outside the selection but why this "1" and "2" result ??