I've just gone thru the process of re-factoring my plugin code only to find out, that a nasty error has been introduced somehow. Have tried to sort it out on my own for days now - am clueless.
I've pin-pointed it down to the sub-statement that is not performing:
It's about the following jQuery selector:
n = $("input[name][type=submit]", fm);
Next, I test for n.length==0 which is firing but NOT desired.
(fm contains a previously initialised jQuery form object, the length of which I've previously checked to be 1 (correct/expected) )
I'd be extremely grateful if someone had an idea?
Thanks in advance!
Further background information:
- You can see it failing on http://www.oeko-fakt.de/produkte/
(press the button "Auswählen" and it will basically do nothing instead of correctly displaying a nice dataTables formatted form, which it had correctly done in previous versions so far)
- The problem has arised or been introduced, since I've refactored the code, otherwise successfully. My first suspicion was maybe the odd local variable having too tight scope, but I do think it's the above expression failing...
12-30-2013, 02:18 AM
Woke up this morning only to find out, that is was (briefly) working.
Now it's back to faltering, without having changed anything in the code (!)
So I'm wondering, whether it may be symptoms of too tight scoping of function variables after all, which could explain this rather random behaviour?
If you "pass out" a variable from within inner function scope to it's client function, can that lead to random behaviour?
(because I've observed that other areas of the plugin are now failing, too, without having changed the algorithm otherwise)
Any hint would be greatly appreciated!
12-31-2013, 04:05 AM
A while ago, I found an article on that it is NOT possible to pass variables, given rise to in inner functions to its client functions, and that it leads to unpredictable results.
Here's something similar that points in the same direction: