lib/utils/editor.js
function(html, caretPos) {
			var reTag = /^<\/?\w[\w\:\-]*.*?>/;
			
			// search left to find opening brace
			var pos = caretPos;
			while (pos > -1) {
				if (html.charAt(pos) == '<') 
					break;
				pos--;
			}
			
			if (pos != -1) {
				var m = reTag.exec(html.substring(pos));
				if (m && caretPos > pos && caretPos < pos + m[0].length)
					return true;
			}
			
			return false;
		}
function(html, caretPos) {
			var reTag = /^<\/?\w[\w\:\-]*.*?>/;
			
			// search left to find opening brace
			var pos = caretPos;
			while (pos > -1) {
				if (html.charAt(pos) == '<') 
					break;
				pos--;
			}
			
			if (pos != -1) {
				var m = reTag.exec(html.substring(pos));
				if (m && caretPos > pos && caretPos < pos + m[0].length)
					return true;
			}
			
			return false;
		}
function ( html , caretPos ) { var reTag = / ^<\/?\w[\w\:\-]*.*?> / ; // search left to find opening brace var pos = caretPos ; while ( pos > - 1 ) { if ( html . charAt ( pos ) == '<' ) break ; pos -- ; } if ( pos != - 1 ) { var m = reTag . exec ( html . substring ( pos ) ) ; if ( m && caretPos > pos && caretPos < pos + m [ 0 ] . length ) return true ; } return false ; }
Check if cursor is placed inside XHTML tag
@param {String} html Contents of the document
@param {Number} caretPos Current caret position inside tag
@return {Boolean}
Check if cursor is placed inside XHTML tag