This repository was archived by the owner on Jan 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
remove unnecessary end tag reset in matchEndTagWithStartTag #38
Open
yukinying
wants to merge
3
commits into
yahoo:master
Choose a base branch
from
yukinying:reset-end-tag
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is true only during https://github.com/yahoo/context-parser/pull/38/files#diff-453c94db9d68bf214cb0505c0e0791b5R245
my two cents: expect to move
this.tags[0] = '';to there or update the comment here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STATE_BEFORE_ATTRIBUTE_NAMEandSTATE_SELF_CLOSING_START_TAGwould only lead toSTATE_DATAwhen an end tag is created.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach seems simpler and easier to follow along. And, not doing a reset for https://github.com/yukinying/context-parser/blob/reset-end-tag/src/context-parser.js#L239 and https://github.com/yukinying/context-parser/blob/reset-end-tag/src/context-parser.js#L242 means we'll need to have another place to reset tags[0] for those cases, which seems complicated. thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whenever these 3 symbols
(StateMachine.Symbol.SPACE = 0, StateMachine.Symbol.SOLIDUS = 6, StateMachine.Symbol.GREATER = 9)are consumed from the state 13, 16, 19, 27 (i.e. they are are RCDATA, RAWTEXT, SCRIPT end tag name state), this extra logic will be triggered and eventually, it will jump back to the DATA state, so settingtags[0] = ''makes sense.however, i am wondering whether it is the right time to reset the
tags[0] = ''. For example, if the input is<textarea></textarea[X]>and X =space, then the tags[0] will be reset and jump tobefore attribute name state. should we reset when transiting to DATA state when symbolStateMachine.Symbol.GREATERis encountered?and do we cover the transition from state 9 to DATA state?
thought?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maditya, since you were the requester for having
tags[0] = ''to be done earlier for html-purifier, could you comment on @neraliu's question?