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

Added Code to HtmlUtils to return info when in closing tag #3419

Merged
merged 5 commits into from
Apr 20, 2013

Conversation

WebsiteDeveloper
Copy link
Contributor

Possible fix for #3407 and #1570.
@RaymondLim you may want to look at this.

@peterflynn
Copy link
Member

Definitely needs unit tests

@ghost ghost assigned RaymondLim Apr 12, 2013
return createTagInfo();
// Check to see if this is the closing of a tag (either the start or end) self closing tag
if (ctx.token.string === ">" || ctx.token.string === "/>") {
return createTagInfo(CLOSING_TAG, offset);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this unless there is a specific use of "CLOSING_TAG" in any feature. Otherwise, you may introduce some unit test failures here. So I suggest that you keep the empty tag info.

@WebsiteDeveloper
Copy link
Contributor Author

@RaymondLim changes pushed.

return createTagInfo();
}

// Check to see if this is the closing of a tag (either the start or end) closing tag
if (ctx.token.string.charAt(0) === "<" && ctx.token.string.charAt(1) === "/") {
return createTagInfo(CLOSING_TAG, offset + 2, ctx.token.string.slice(2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're adjusting the offset in the wrong direction. Consider this example: </|h2> where | is the cursor position. You will have offset equals to 2 and token string equals to "</h2" before your changes. Since you're stripping off "</" from the token string, the caller will get "h2" as the tag name and you should have offset set to zero, indicating the cursor is before the returned string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually i misinterpreted the meaning of the offset, now it is clear to me.

@RaymondLim
Copy link
Contributor

Done second review.

@WebsiteDeveloper
Copy link
Contributor Author

@RaymondLim fixes pushed.

return createTagInfo();
}

// Check to see if this is the closing of a tag (either the start or end) closing tag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I should have caught this in the previous round of review. This comment is no longer correct. We're just handling closing tag here.

@WebsiteDeveloper
Copy link
Contributor Author

@RaymondLim fixes pushed.

@RaymondLim
Copy link
Contributor

Looks good. Merging.

RaymondLim added a commit that referenced this pull request Apr 20, 2013
Added Code to HtmlUtils to return info when in closing tag
@RaymondLim RaymondLim merged commit 45e9571 into adobe:master Apr 20, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants