Skip to content

Elements to be avoided #11

@ethantw

Description

@ethantw

Avoiding child elements, such as <style> and <script>, to be replaced inside the target elements is necessary; otherwise, it would simply keep them from executing. For example,

<p id="tester">
    <style scoped>span {  color: red;  }</style>

    <span>Hello,</span>
    people in red.
</p>

<script>
findAndReplaceDOMText(
    /red/g,
    document.getElementById('tester'),
    'em'
);
</script>

Would outputs,

<p id="tester">
    <style scoped>span {  color: <em>red</em>;  }</style>

    <span>Hello,</span>
    people in <em>red</em>.
</p>

Tried editing the function, but just not able to make it right. Hoping this could be solved.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions