Last active
          August 29, 2015 14:00 
        
      - 
      
- 
        Save tlimpanont/5db82ca6419c5880a067 to your computer and use it in GitHub Desktop. 
    find all nodes in DOM with RegExp and delete classNames
  
        
  
    
      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
    
  
  
    
  | var walk_the_DOM = function walk(node, func) { | |
| func(node); | |
| node = node.firstChild; | |
| while (node) { | |
| walk(node, func); | |
| node = node.nextSibling; | |
| } | |
| }; | |
| function removeRegExClassesFromDOM(className) { | |
| walk_the_DOM(document.body, function (node) { | |
| if (node.nodeType == 1) { | |
| if (new RegExp(className).exec(node.className)) { | |
| node.className = ""; | |
| } | |
| } | |
| }); | |
| } | |
| //removeRegExpClassesFromDOM('helloMyName'); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment