I’m trying to determine if an element if an image or not using jQuery. This should be straightforward using $('selector').is('img'), but that’s not working. Here is a screenshot from Chrome’s watch expression console. I don’t understand why the is() function is failing. The debugger says the element is an HTMLImageElement. Any suggestions?
var selectedElement = ckEditor.getSelection().getSelectedElement();
var $element = $(selectedElement);
var isImage = $element.is('img');

The documentation says that
.getSelectedElement()returns an instance ofCKEDITOR.dom.elementand not a native DOM element. So when calling jQuery, you’re wrapping another wrapper, which doesn’t play nicely – jQuery doesn’t know how to deal with those CKEditor objects. What the documentation also says is that the$property is the native DOM element, so: