This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
Replace function only replaces one inline script #6
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.
descript.replace
does not replace text across multiple inline scripts. This is a safety guard that is implemented in the descript replace function. We want to ensure there is no un-intentional inline script replacement.descript.replace
doesn't allow more than 1 search type. For example, the following will not work:However, in the following example, we have the following behaviour:
There are 2 scripts that contains an ID you need to replace:
The following line will only replace all instance of the text of the second script and not the first script because descript works in reverse order.
I am not sure to call this a feature or a bug. We are making sure that we are replacing only one inline script at a time. However, it is confusing not knowing that the first script did not have replace performed.
Question:
Should we make replace function perform replacement to all inline script instance found with the single search type?
Status: Opened for visibility
Reviewers: @donnielrt @fractaltheory @jansepar
JIRA: #5
Changes
Notes