CodeSOD: The Generated JavaScript |
Once upon a time, I discovered a bug in some JavaScript. I went off to investigate the source, only to find… the JS wasn’t coming from a file. It was being generated by a server-side method. Through string concatenation. It was a simple generation, something along the lines of:
jsCode += "location.href = 'foo?id=" + someIdField + "';\n";
Bad, but a minor WTF- and the bug was caused because someIdField contained characters which needed to be escaped. It was actually unnecessary, and I could construct the logic completely on the client-side, which is what I ended up doing in that case.
I bring that tale up, because Konstantinos T has a special case of anguish.
| Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |