The 'contents' of a Text item contains the plain unformatted text, so it's puzzling why you thought that would somehow work ...
Try http://jongware.mit.edu/idcs6js/pc_Text.html#allGraphics ("Lists all graphics contained by the Text.")
As it happens, "allGraphics" is also available for Cell (so you don't have to use 'texts'), Row (so you don't have to use "rows.everyItem"), and even for Table ... There is no need to drill down to individual texts in cells and gathering them together using everyItem -- simply use
if (myActiveTable.allGraphics.length > 0)
it contains an inline graphic.
Looping over all images and over all tables does not seem necessary, as an image inside a table "is" a link straight to the object, and in reverse, every inline image knows where it is located. Then again, it depends on what information you need to be able to recommend from what angle you should approach this.
I would recommend you not to use my on-line version of the DOM reference but download the searchable and indexed CHM version instead. Pick the one you need for your ID version from http://www.jongware.com/idjshelp.html. If you are using Windows, you can use it straight away; for the Mac, you need to find a suitable CHM viewer.
All I had to do was look up "allGraphics" in the index to get an immediate list of objects that supported this property; then, it's just a case of point-and-click to walk up and down the object hierarchy to git to whereever you want to get.
Now I want to point to allGraphics in stories except those placed within tables!??
You said you wanted "to check if a table cell contains an inline graphic", but I think that what you mean is "I want to check if an inline graphic is in a table". That's not so hard:
myImages = myDoc.allGraphics;
for (i = 0; i < myImages.length; i++)
if (myImages[i].parent.parent.parent.constructor.name != "Cell")
// image is not in a cell
I see that Trevor had the same idea in another thread on the same topic...