@@ -32,6 +32,7 @@ define(function (require, exports, module) {
3232
3333 //constants
3434 var TAG_NAME = "tagName" ,
35+ CLOSING_TAG = "closingTag" ,
3536 ATTR_NAME = "attr.name" ,
3637 ATTR_VALUE = "attr.value" ;
3738
@@ -399,12 +400,16 @@ define(function (require, exports, module) {
399400 return createTagInfo ( ) ;
400401 }
401402
402- // Check to see if this is the closing of a tag (either the start or end)
403- if ( ctx . token . string === ">" || ctx . token . string === "/>" ||
404- ( ctx . token . string . charAt ( 0 ) === "<" && ctx . token . string . charAt ( 1 ) === "/" ) ) {
403+ // Check to see if this is the closing of a start tag or a self closing tag
404+ if ( ctx . token . string === ">" || ctx . token . string === "/>" ) {
405405 return createTagInfo ( ) ;
406406 }
407407
408+ // Check to see if this is a closing tag
409+ if ( ctx . token . string . charAt ( 0 ) === "<" && ctx . token . string . charAt ( 1 ) === "/" ) {
410+ return createTagInfo ( CLOSING_TAG , offset - 2 , ctx . token . string . slice ( 2 ) ) ;
411+ }
412+
408413 // Make sure the cursor is not after an equal sign or a quote before we report the context as a tag.
409414 if ( ctx . token . string !== "=" && ctx . token . string . match ( / ^ [ " ' ] / ) === null ) {
410415 if ( ! tokenType ) {
@@ -504,14 +509,15 @@ define(function (require, exports, module) {
504509
505510
506511 // Define public API
507- exports . TAG_NAME = TAG_NAME ;
508- exports . ATTR_NAME = ATTR_NAME ;
509- exports . ATTR_VALUE = ATTR_VALUE ;
512+ exports . TAG_NAME = TAG_NAME ;
513+ exports . CLOSING_TAG = CLOSING_TAG ;
514+ exports . ATTR_NAME = ATTR_NAME ;
515+ exports . ATTR_VALUE = ATTR_VALUE ;
510516
511- exports . getTagInfo = getTagInfo ;
517+ exports . getTagInfo = getTagInfo ;
512518 exports . getTagAttributes = getTagAttributes ;
513519 //The createTagInfo is really only for the unit tests so they can make the same structure to
514520 //compare results with
515- exports . createTagInfo = createTagInfo ;
521+ exports . createTagInfo = createTagInfo ;
516522 exports . findStyleBlocks = findStyleBlocks ;
517523} ) ;
0 commit comments