[Bug 28931] Avoid for ... in loops in SemanticForms.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=28931 --- Comment #3 from Benjamin Langguth langg...@ontoprise.de 2011-05-12 09:12:29 UTC --- Thank you applying the patch. Yes, the issue arised from the use of the PrototypeJS lib (in SMW+). I don't know the current effort on transform all prototype scripts to jQuery but i'm going to ask our dev team about it. All i can say is that upcoming scripts are mostly implemented in jQuery now. @Bawolff: Yes, this recommendation would cover most cases since it skips prototype members of the object (e.g. added by libraries). But the following code would still not work as expected: var a, index; a = ['a', 'b', 'c']; a.name = 'MyArray'; for (index in a) // = WRONG { if (a.hasOwnProperty(index)) { alert(index + ' = ' + a[index]); } } -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 28931] Avoid for ... in loops in SemanticForms.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=28931 --- Comment #4 from Bawolff bawolff...@gmail.com 2011-05-12 19:16:09 UTC --- (In reply to comment #3) @Bawolff: Yes, this recommendation would cover most cases since it skips prototype members of the object (e.g. added by libraries). But the following code would still not work as expected: var a, index; a = ['a', 'b', 'c']; a.name = 'MyArray'; for (index in a) // = WRONG { if (a.hasOwnProperty(index)) { alert(index + ' = ' + a[index]); } } Well I suppose that varies with your definition of expected. It would behave how I expect it would, as well as exactly the same as how such constructs behave in other languages like PHP. A basic for loop is probably always better when you just want to go through the numeric keys in order. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 28931] Avoid for ... in loops in SemanticForms.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=28931 Yaron Koren yaro...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #1 from Yaron Koren yaro...@gmail.com 2011-05-11 16:27:59 UTC --- Alright, that seemed like a reasonable suggestion, so I made those changes in SVN. Thanks for the patch. I assume this is for use by SMW+ - out of curiosity, are you planning to switch from Prototype to jQuery at any point, or are you staying with Prototype? -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 28931] Avoid for ... in loops in SemanticForms.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=28931 Bawolff bawolff...@gmail.com changed: What|Removed |Added CC||bawolff...@gmail.com --- Comment #2 from Bawolff bawolff...@gmail.com 2011-05-12 00:47:58 UTC --- Note, you don't necessarily have to not use for..in loops, you just need to use the hasOwnProperty method of Object to check. (see http://javascript.crockford.com/code.html#for%20statement ) -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
[Bug 28931] Avoid for ... in loops in SemanticForms.js
https://bugzilla.wikimedia.org/show_bug.cgi?id=28931 p858snake p858sn...@gmail.com changed: What|Removed |Added Keywords||patch, reviewed CC||p858sn...@gmail.com -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l