bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
function(node, offset, source) {
			if(node && source) {
				switch(node.type) {
					case 'tag': {
						// Smarter way now that we have end ranges
						if (node.endrange){
							return offset > node.endrange[0] && offset < node.endrange[1];
						}
						// TODO Delete the old way
						var _s = source.slice(node.range[0], node.range[1]);
						var _r = new RegExp("<\\s*\/\\s*"+node.name+"\\s*>$"); //$NON-NLS-1$ //$NON-NLS-2$
						var _m = _r.exec(_s);
						if(_m) {
							return offset > (_m.index+node.range[0]) && offset < node.range[1];
						}
						break;
					}
					default: {
						var _p = node.parent;
						if(_p && _p.type === 'tag') {
							return Array.isArray(_p.children) && _p.children.length > 0 && (offset > _p.children[_p.children.length-1].range[1]) && offset <= _p.range[1];
						}
						break;
					}
				}
			}
			return false;
		}
function(node, offset, source) {
			if(node && source) {
				switch(node.type) {
					case 'tag': {
						// Smarter way now that we have end ranges
						if (node.endrange){
							return offset > node.endrange[0] && offset < node.endrange[1];
						}
						// TODO Delete the old way
						var _s = source.slice(node.range[0], node.range[1]);
						var _r = new RegExp("<\\s*\/\\s*"+node.name+"\\s*>$"); //$NON-NLS-1$ //$NON-NLS-2$
						var _m = _r.exec(_s);
						if(_m) {
							return offset > (_m.index+node.range[0]) && offset < node.range[1];
						}
						break;
					}
					default: {
						var _p = node.parent;
						if(_p && _p.type === 'tag') {
							return Array.isArray(_p.children) && _p.children.length > 0 && (offset > _p.children[_p.children.length-1].range[1]) && offset <= _p.range[1];
						}
						break;
					}
				}
			}
			return false;
		}
function ( node , offset , source ) { if ( node && source ) { switch ( node . type ) { case 'tag' : { // Smarter way now that we have end ranges if ( node . endrange ) { return offset > node . endrange [ 0 ] && offset < node . endrange [ 1 ] ; } // TODO Delete the old way var _s = source . slice ( node . range [ 0 ] , node . range [ 1 ] ) ; var _r = new RegExp ( "<\\s*\/\\s*" + node . name + "\\s*>$" ) ; //$NON-NLS-1$ //$NON-NLS-2$ var _m = _r . exec ( _s ) ; if ( _m ) { return offset > ( _m . index + node . range [ 0 ] ) && offset < node . range [ 1 ] ; } break ; } default : { var _p = node . parent ; if ( _p && _p . type === 'tag' ) { return Array . isArray ( _p . children ) && _p . children . length > 0 && ( offset > _p . children [ _p . children . length - 1 ] . range [ 1 ] ) && offset <= _p . range [ 1 ] ; } break ; } } } return false ; }
Returns if the offset is in a closing tag. A closing tag is determined as an
offset past the last child but before the closing range of the tag itself
@param {Object} node The AST not context
@param {Number} offset The curren offset
@param {String} source The source
Returns if the offset is in a closing tag . A closing tag is determined as an offset past the last child but before the closing range of the tag itself