Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit a079da6

Browse files
A few refactorings
1 parent 391342c commit a079da6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/editor/CSSInlineEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ define(function (require, exports, module) {
4444
var tagInfo = HTMLUtils.getTagInfo(editor, pos),
4545
selectorName = "";
4646

47-
if (tagInfo.position.tokenType === HTMLUtils.TAG_NAME) {
47+
if (tagInfo.position.tokenType === HTMLUtils.TAG_NAME || tagInfo.position.tokenType === HTMLUtils.CLOSING_TAG) {
4848
// Type selector
4949
selectorName = tagInfo.tagName;
5050
} else if (tagInfo.position.tokenType === HTMLUtils.ATTR_NAME ||

src/language/HTMLUtils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,11 @@ define(function (require, exports, module) {
407407

408408
// Check to see if this is the closing of a tag (either the start or end) closing tag
409409
if (ctx.token.string.charAt(0) === "<" && ctx.token.string.charAt(1) === "/") {
410-
return createTagInfo(CLOSING_TAG, offset, ctx.token.string.slice(2, ctx.token.string.indexOf(">")));
410+
if (ctx.token.string.indexOf(">") === -1) {
411+
return createTagInfo(CLOSING_TAG, offset, ctx.token.string.slice(2));
412+
} else {
413+
return createTagInfo(CLOSING_TAG, offset, ctx.token.string.slice(2, ctx.token.string.indexOf(">") + 1));
414+
}
411415
}
412416

413417
// Make sure the cursor is not after an equal sign or a quote before we report the context as a tag.

0 commit comments

Comments
 (0)