Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

[Feature Request] Add a replaceAll function that replace across multiple inline scripts #5

Open
wizardlyhel opened this issue Jun 18, 2015 · 1 comment

Comments

@wizardlyhel
Copy link
Contributor

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. However, sometime we do need intentional replacement across multiple inline scripts.

For example, there are 2 scripts that contains an ID you need to replace:

<script>
    ...
    var ID="123456789";
    var sID="123456789";
    ....
</script>
...
<script>
    ...
    var mob_ID="123456789"
    var tab_ID="123456789"
   ...
</script>

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.

descript.replace({contains: '123456789'}, /123456789/g,'987654321');
@donnielrt
Copy link
Contributor

@Helen-Mobify we won't really have the bandwidth to add this feature in the mid-term, but if you open a PR with the change, we can merge it in. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants