EtherAddressLookup
EtherAddressLookup copied to clipboard
Replace regex replace pattern with closure methods
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
this.replaceMethods = [
'EtherAddressMethodReplace',
'OtherReplaceMethod',
'YetAnotherReplaceMethod'
];
generateReplacementContent(content)
{
for(var i=0; i < this.regExPatterns.length; i++){
content = content.replace(this.regExPatterns[i], function(match, p1, p2, p3){this[this.replaceMethods[i]](match, p1, p2, p3)});
}
return content;
}
Basically we need to build our DOM with methods because Mozilla says it's better.