Get the selection type (like dojo.doc.select.type in IE).
if(dojo.doc.selection){ //IE return dojo.doc.selection.type.toLowerCase(); }else{ var stype = "text"; // Check if the actual selection is a CONTROL (IMG, TABLE, HR, etc...). var oSel; try{ oSel = dojo.global.getSelection(); }catch(e){ /*squelch*/ } if(oSel && oSel.rangeCount==1){ var oRange = oSel.getRangeAt(0); if( (oRange.startContainer == oRange.endContainer) && ((oRange.endOffset - oRange.startOffset) == 1) && (oRange.startContainer.nodeType != 3 /* text node*/) ){ stype = "control"; } } return stype; }