0 Replies Latest reply on Apr 12, 2011 9:11 AM by xmlapi

    findItems returns null

    xmlapi

      I have the common findItems function that was mentioned here. The issue is that when I use it on anchored objects, it returns null WHEN the object is empty (no text etc). Is there any reason why it does this?

       

      Object.prototype.findItems = function(/*obj*/props)
      {
          if( !('everyItem' in this) )
              {
              throw new Error("Error: " + this + " is not a collection.");
              }

          var ret = this.everyItem().getElements(),
              i = ret.length,
              e, p;

          while( i-- && e=ret[i] )
              {
              for( p in props )
                  {
                  if( (p in e) && e[p]===props[p] ) continue;
                  ret.splice(i,1);
                  }
              }
          return ret;
      };