|
|
|
|
|
by PokestarFan
464 days ago
|
|
I don't see how it should be too hard to implement, you could abstractly have a system where the command string is translated as such: 1. Split the string by dashes into an array 2. Make the first character of the first array item lowercase, make the first character of the rest uppercase 3. Concatenate the pieces together 4. Do `document.getElementById(element.commandfor)[concatenated]()` Obviously this doesn't have the myriad number of checks to make sure that the element exists, the method exists, the method takes no parameters, etc. This would also allow custom commands easily, since you could do `document.getElementById(element.commandfor).myCustomMethod = function() { /* ... */ }` |
|