rem: for(var i=0, j=0; (i = icalStr.indexOf("BEGIN:VEVENT", j)) != -1; ) {  j = icalStr.indexOf("END:VEVENT", i + "BEGIN:VEVENT".length); j = (j == -1? icalStr.length : j + "END:VEVENT".length); var eventData = icalStr.substring(i, j); 
add: var eventData = icalStr.substring(i, j); var calendarEvent = createEvent(); calendarEvent.icalString = eventData; 
context: function parseIcalEvents( icalStr ){   var calendarEventArray =  new Array();   for(var i=0, j=0; (i = icalStr.indexOf("BEGIN:VEVENT", j)) != -1; )   {       // try to find the begin and end of an event. ParseIcalString does not support VCALENDAR      j = icalStr.indexOf("END:VEVENT", i + "BEGIN:VEVENT".length);      j = (j == -1? icalStr.length : j + "END:VEVENT".length);      var eventData = icalStr.substring(i, j);      var calendarEvent = createEvent();      // if parsing import iCalendar failed, add data as description      if ( !calendarEvent.parseIcalString(eventData) )      {         // initialize start and end dates.         initCalendarEvent( calendarEvent );         // Save the parsed text as description.         calendarEvent.description = eventData;            }      calendarEventArray[ calendarEventArray.length ] = calendarEvent;   }      return calendarEventArray;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/dc5c8682eb051e91cbfee84f9933ff32e91a2a1b/importExport.js/buggy/calendar/resources/content/importExport.js