Dom7 : access to original JavaScript HTML DOM Elements

I’m experimenting various third party ways to force image caching in Cordova and I’ve come across a silly problem. I’m hooking into the itemBeforeInsert event on a virtual list and implementing some third party library code …

var cacheImage = $$(itemEl).find('img.cache-image');
ImgCache.isCached(cacheImage.attr('src'), function(path, success) {
  if (success) {
    console.log( 'already cached' );
    ImgCache.useCachedFile(cacheImage);
  } else {
    console.log( 'not there, need to cache the image' );
    ImgCache.cacheFile(cacheImage.attr('src'), function () {
      ImgCache.useCachedFile(cacheImage);
    });
  }
});

I’m getting this error because it’s part using Dom7 and part using JavaScript HTML DOM Elements :

TypeError: element.getAttribute is not a function.

Any idea how I can retrieve the original from a Dom7 query?

cacheImage[0] will give you a HTMLElememt

1 Like

Of course, like jquery. Should have really tried that. Sorry.