Misc Web Development utility functions
- Removes empty nodes/html from the both side of a given html template or String.
- Input:
<div></div> <div></div> <div></div> <div></div> <div>hello</div>
- Output:
<div>hello</div>
- Input:
<div>hello</div> <div></div> <div></div> <div></div> <div></div>
- Output:
<div>hello</div>
- Input:
<div></div> <div></div> <div></div> <div></div> <div> hello</div>
- Output:
<div>hello</div>
- Input:
<div>hello </div> <div></div> <div></div> <div></div> <div></div>
- Output:
<div>hello</div>
Example-5: Remove all empty nodes from begining and end also start trim first non empty nodes and end trim last non empty nodes.
- Input:
<div></div> <div></div> <div></div> <div></div> <div> hello1 </div> <div></div> <div></div> <div></div> <div></div> <div> hello2 </div> <div></div> <div></div> <div></div> <div></div>
- Output:
<div>hello1 </div> <div></div> <div></div> <div></div> <div></div> <div> hello2</div>
- Input:
<div></div> <div></div> <div></div> <div></div> <div> <div></div> <div></div> <div></div> <div></div> <div> hello1 </div> <div></div> <div></div> <div> hello2 </div> <div></div> <div></div> </div> <div></div> <div></div> <div></div> <div></div>
- Output:
<div> <div>hello1 </div> <div></div> <div></div> <div> hello2</div> </div>
- Input:
hello1 <div> <div></div> <div> hello2 </div> <div></div> <div></div> <div> hello3 </div> <div></div> <div></div> </div> <div></div> <div></div> <div></div> <div></div>
- Output:
hello1 <div> <div></div> <div> hello2 </div> <div></div> <div></div> <div> hello3</div> </div>
- Opens virtual keyboard in touch devices
- There is no support of replaceAll method in old browsers, so it is its wrapper method which if browser's replaceAll method is available, it will use it, otherwise it will replace with custom logic using lodash's replace method.