src/liveAddressPlugin.js
function filterDomElement(domElement, names, labels) {
			/*
			 Where we look to find a match, in this order:
			 name, id, <label> tags, placeholder, title
			 Our searches first conduct fairly liberal "contains" searches:
			 if the attribute even contains the name or label, we map it.
			 The names and labels we choose to find are very particular.
			 */

			var name = lowercase(domElement.name);
			var id = lowercase(domElement.id);
			var selectorSafeID = id.replace(/[\[|\]|\(|\)|\:|\'|\"|\=|\||\#|\.|\!|\||\@|\^|\&|\*]/g, "\\\\$&");
			var placeholder = lowercase(domElement.placeholder);
			var title = lowercase(domElement.title);

			// First look through name and id attributes of the element, the most common
			for (var i = 0; i < names.length; i++)
				if (name.indexOf(names[i]) > -1 || id.indexOf(names[i]) > -1)
					return true;

			// If we can't find it in name or id, look at labels associated to the element.
			// Webkit automatically associates labels with form elements for us. But for other
			// browsers, we have to find them manually, which this next block does.
			if (!("labels" in domElement)) {
				var lbl = $("label[for=\"" + selectorSafeID + "\"]")[0] || $(domElement).parents("label")[0];
				domElement.labels = !lbl ? [] : [lbl];
			}

			// Iterate through the <label> tags now to search for a match.
			for (var i = 0; i < domElement.labels.length; i++) {
				// This inner loop compares each label value with what we're looking for
				for (var j = 0; j < labels.length; j++)
					if ($(domElement.labels[i]).text().toLowerCase().indexOf(labels[j]) > -1)
						return true;
			}

			// Still not found? Then look in "placeholder" or "title"...
			for (var i = 0; i < labels.length; i++)
				if (placeholder.indexOf(labels[i]) > -1 || title.indexOf(labels[i]) > -1)
					return true;

			// Got all the way to here? Probably not a match then.
			return false;
		}
function filterDomElement(domElement, names, labels) {
			/*
			 Where we look to find a match, in this order:
			 name, id, <label> tags, placeholder, title
			 Our searches first conduct fairly liberal "contains" searches:
			 if the attribute even contains the name or label, we map it.
			 The names and labels we choose to find are very particular.
			 */

			var name = lowercase(domElement.name);
			var id = lowercase(domElement.id);
			var selectorSafeID = id.replace(/[\[|\]|\(|\)|\:|\'|\"|\=|\||\#|\.|\!|\||\@|\^|\&|\*]/g, "\\\\$&");
			var placeholder = lowercase(domElement.placeholder);
			var title = lowercase(domElement.title);

			// First look through name and id attributes of the element, the most common
			for (var i = 0; i < names.length; i++)
				if (name.indexOf(names[i]) > -1 || id.indexOf(names[i]) > -1)
					return true;

			// If we can't find it in name or id, look at labels associated to the element.
			// Webkit automatically associates labels with form elements for us. But for other
			// browsers, we have to find them manually, which this next block does.
			if (!("labels" in domElement)) {
				var lbl = $("label[for=\"" + selectorSafeID + "\"]")[0] || $(domElement).parents("label")[0];
				domElement.labels = !lbl ? [] : [lbl];
			}

			// Iterate through the <label> tags now to search for a match.
			for (var i = 0; i < domElement.labels.length; i++) {
				// This inner loop compares each label value with what we're looking for
				for (var j = 0; j < labels.length; j++)
					if ($(domElement.labels[i]).text().toLowerCase().indexOf(labels[j]) > -1)
						return true;
			}

			// Still not found? Then look in "placeholder" or "title"...
			for (var i = 0; i < labels.length; i++)
				if (placeholder.indexOf(labels[i]) > -1 || title.indexOf(labels[i]) > -1)
					return true;

			// Got all the way to here? Probably not a match then.
			return false;
		}
function filterDomElement ( domElement , names , labels ) { /*
			 Where we look to find a match, in this order:
			 name, id, <label> tags, placeholder, title
			 Our searches first conduct fairly liberal "contains" searches:
			 if the attribute even contains the name or label, we map it.
			 The names and labels we choose to find are very particular.
			 */ var name = lowercase ( domElement . name ) ; var id = lowercase ( domElement . id ) ; var selectorSafeID = id . replace ( / [\[|\]|\(|\)|\:|\'|\"|\=|\||\#|\.|\!|\||\@|\^|\&|\*] / g , "\\\\$&" ) ; var placeholder = lowercase ( domElement . placeholder ) ; var title = lowercase ( domElement . title ) ; // First look through name and id attributes of the element, the most common for ( var i = 0 ; i < names . length ; i ++ ) if ( name . indexOf ( names [ i ] ) > - 1 || id . indexOf ( names [ i ] ) > - 1 ) return true ; // If we can't find it in name or id, look at labels associated to the element. // Webkit automatically associates labels with form elements for us. But for other // browsers, we have to find them manually, which this next block does. if ( ! ( "labels" in domElement ) ) { var lbl = $ ( "label[for=\"" + selectorSafeID + "\"]" ) [ 0 ] || $ ( domElement ) . parents ( "label" ) [ 0 ] ; domElement . labels = ! lbl ? [ ] : [ lbl ] ; } // Iterate through the <label> tags now to search for a match. for ( var i = 0 ; i < domElement . labels . length ; i ++ ) { // This inner loop compares each label value with what we're looking for for ( var j = 0 ; j < labels . length ; j ++ ) if ( $ ( domElement . labels [ i ] ) . text ( ) . toLowerCase ( ) . indexOf ( labels [ j ] ) > - 1 ) return true ; } // Still not found? Then look in "placeholder" or "title"... for ( var i = 0 ; i < labels . length ; i ++ ) if ( placeholder . indexOf ( labels [ i ] ) > - 1 || title . indexOf ( labels [ i ] ) > - 1 ) return true ; // Got all the way to here? Probably not a match then. return false ; }
This function is used to find and properly map elements to their field type
This function is used to find and properly map elements to their field type