lib/actions/select-item.js
function getRangesFromHTMLNode(node) {
	if (node.type !== 'tag') {
		return [];
	}

	let ranges = [ getRange(node.open.name) ];

	if (node.attributes) {
		node.attributes.forEach(attr => {
			ranges.push(getRange(attr));
			if (!attr.boolean) {
				// add attribute value (unquoted) range for non-boolean attributes
				ranges.push(getRange(attr.value));

				if (attr.name.value.toLowerCase() === 'class') {
					// In case of `class` attribute, add each class item
					// as selection range, but only if this value is not
					// an expression (for example, React expression like
					// `class={items.join(' ')}`)
					ranges = ranges.concat(attributeValueTokens(attr.value));
				}
			}
		});
	}

	return uniqueRanges(ranges.filter(Boolean));
}
function getRangesFromHTMLNode(node) {
	if (node.type !== 'tag') {
		return [];
	}

	let ranges = [ getRange(node.open.name) ];

	if (node.attributes) {
		node.attributes.forEach(attr => {
			ranges.push(getRange(attr));
			if (!attr.boolean) {
				// add attribute value (unquoted) range for non-boolean attributes
				ranges.push(getRange(attr.value));

				if (attr.name.value.toLowerCase() === 'class') {
					// In case of `class` attribute, add each class item
					// as selection range, but only if this value is not
					// an expression (for example, React expression like
					// `class={items.join(' ')}`)
					ranges = ranges.concat(attributeValueTokens(attr.value));
				}
			}
		});
	}

	return uniqueRanges(ranges.filter(Boolean));
}
function getRangesFromHTMLNode ( node ) { if ( node . type !== 'tag' ) { return [ ] ; } let ranges = [ getRange ( node . open . name ) ] ; if ( node . attributes ) { node . attributes . forEach ( attr => { ranges . push ( getRange ( attr ) ) ; if ( ! attr . boolean ) { // add attribute value (unquoted) range for non-boolean attributes ranges . push ( getRange ( attr . value ) ) ; if ( attr . name . value . toLowerCase ( ) === 'class' ) { // In case of `class` attribute, add each class item // as selection range, but only if this value is not // an expression (for example, React expression like // `class={items.join(' ')}`) ranges = ranges . concat ( attributeValueTokens ( attr . value ) ) ; } } } ) ; } return uniqueRanges ( ranges . filter ( Boolean ) ) ; }
Returns possible selection ranges for given HTML model node
@param  {Node} node
@return {Range[]}
Returns possible selection ranges for given HTML model node