https://bugzilla.wikimedia.org/show_bug.cgi?id=28931

       Web browser: ---
             Bug #: 28931
           Summary: Avoid "for ... in" loops in SemanticForms.js
           Product: MediaWiki extensions
           Version: any
          Platform: PC
        OS/Version: Windows 7
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: SemanticForms
        AssignedTo: yaro...@gmail.com
        ReportedBy: langg...@ontoprise.de
                CC: wikibugs-l@lists.wikimedia.org
    Classification: Unclassified


Created attachment 8528
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=8528
This patch reverts for-in loops back to basic style.

The Semantic Forms extension uses "for ... in" loops for iterating through the
indexes of an array. But "for ... in" actually iterates through the property
names of an object.

If the array has additional properties (e.g. from PrototypeJS) like

a.name = 'MyArray';

the JS can break with "for ... in" loops.

More information could be found at
http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays.

Therefore i recommend to revert "for ... in" loops back to the basic vanilla
"for (;;)" style.

I attach a patch that applies these changes to /libs/SemanticForms.js

-- 
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

Reply via email to