lib/utils/action.js
function(editor, pos) {
			var allowedSyntaxes = {'html': 1, 'xml': 1, 'xsl': 1, 'jsx': 1};
			var syntax = editor.getSyntax();
			if (syntax in allowedSyntaxes) {
				var content = editor.getContent();
				if (typeof pos === 'undefined') {
					pos = editor.getCaretPos();
				}

				var tag = htmlMatcher.find(content, pos);
				if (tag && tag.type == 'tag') {
					var startTag = tag.open;
					var contextNode = {
						name: startTag.name,
						attributes: [],
						match: tag
					};
					
					// parse attributes
					var tagTree = xmlEditTree.parse(startTag.range.substring(content));
					if (tagTree) {
						contextNode.attributes = tagTree.getAll().map(function(item) {
							return {
								name: item.name(),
								value: item.value()
							};
						});
					}
					
					return contextNode;
				}
			}
			
			return null;
		}
function(editor, pos) {
			var allowedSyntaxes = {'html': 1, 'xml': 1, 'xsl': 1, 'jsx': 1};
			var syntax = editor.getSyntax();
			if (syntax in allowedSyntaxes) {
				var content = editor.getContent();
				if (typeof pos === 'undefined') {
					pos = editor.getCaretPos();
				}

				var tag = htmlMatcher.find(content, pos);
				if (tag && tag.type == 'tag') {
					var startTag = tag.open;
					var contextNode = {
						name: startTag.name,
						attributes: [],
						match: tag
					};
					
					// parse attributes
					var tagTree = xmlEditTree.parse(startTag.range.substring(content));
					if (tagTree) {
						contextNode.attributes = tagTree.getAll().map(function(item) {
							return {
								name: item.name(),
								value: item.value()
							};
						});
					}
					
					return contextNode;
				}
			}
			
			return null;
		}
function ( editor , pos ) { var allowedSyntaxes = { 'html' : 1 , 'xml' : 1 , 'xsl' : 1 , 'jsx' : 1 } ; var syntax = editor . getSyntax ( ) ; if ( syntax in allowedSyntaxes ) { var content = editor . getContent ( ) ; if ( typeof pos === 'undefined' ) { pos = editor . getCaretPos ( ) ; } var tag = htmlMatcher . find ( content , pos ) ; if ( tag && tag . type == 'tag' ) { var startTag = tag . open ; var contextNode = { name : startTag . name , attributes : [ ] , match : tag } ; // parse attributes var tagTree = xmlEditTree . parse ( startTag . range . substring ( content ) ) ; if ( tagTree ) { contextNode . attributes = tagTree . getAll ( ) . map ( function ( item ) { return { name : item . name ( ) , value : item . value ( ) } ; } ) ; } return contextNode ; } } return null ; }
Captures context XHTML element from editor under current caret position.
This node can be used as a helper for abbreviation extraction
@param {IEmmetEditor} editor
@returns {Object}
Captures context XHTML element from editor under current caret position . This node can be used as a helper for abbreviation extraction