Having trouble understand jquery functions

Having trouble understand jquery functions

Hey guys,
 
In order to further my understanding of Jquery I was trying to develop a chrome extension using the script below, and I was wondering where the script searched the page.

Thanks,
Jake  

  1. //Script:
  2. /*!
  3.  * jQuery replaceText - v1.1 - 11/21/2009
  4.  * http://benalman.com/projects/jquery-replacetext-plugin/
  5.  * 
  6.  * Copyright (c) 2009 "Cowboy" Ben Alman
  7.  * Dual licensed under the MIT and GPL licenses.
  8.  * http://benalman.com/about/license/
  9.  *
  10.  * Adapted by Laurent Van Winckel for Clickable Links, anno 2012.
  11.  */
  12. (function($){
  13.   '$:nomunge'; // Used by YUI compressor.
  14.   
  15.   $.fn.replaceText = function( search, replace, text_only ) {
  16.     return this.each(function(){
  17.       var node = this.firstChild,
  18.         val,
  19.         new_val,
  20.         
  21.         // Elements to be removed at the end.
  22.         remove = [];
  23.       
  24.       // Laurent: exclude some tags
  25.       var exTags=['a', 'head', 'noscript', 'option', 'script', 'style', 'title', 'textarea', 'pre', 'xmp', 'input'];
  26.       
  27.       if ( node && $.inArray(this.nodeName.toLowerCase(), exTags) == -1 ) { // Laurent: exclude some tags
  28.         
  29.         // Loop over all childNodes. 
  30.         do {
  31.           
  32.           // Only process text nodes.
  33.           if ( node.nodeType === 3 ) {
  34.             
  35.             // The original node value.
  36.             val = node.nodeValue;
  37.             
  38.             // The new value.
  39.             new_val = val.replace( search, replace );
  40.             
  41.             // Only replace text if the new value is actually different!
  42.             if ( new_val !== val ) {
  43.               
  44.               if ( !text_only && /</.test( new_val ) ) {
  45.                 // The new value contains HTML, set it in a slower but far more
  46.                 // robust way.
  47.                 $(node).before( new_val );
  48.                 
  49.                 // Don't remove the node yet, or the loop will lose its place.
  50.                 remove.push( node );
  51.               } else {
  52.                 // The new value contains no HTML, so it can be set in this
  53.                 // very fast, simple way.
  54.                 node.nodeValue = new_val;
  55.               }
  56.             }
  57.           }
  58.           
  59.         } while ( node = node.nextSibling );
  60.       }
  61.       
  62.       // Time to remove those elements!
  63.       remove.length && $(remove).remove();
  64.     });
  65.   };  
  66.   
  67. })(jQuery);