nicowesse / geoxml3

Automatically exported from code.google.com/p/geoxml3
0 stars 0 forks source link

Order of parser.docs reversed from doc.internals.docset #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add three kml documents to one invocation of parse
2. Add custom afterparse function and evaluate document set
3. Compare to parser's docs

What is the expected output? What do you see instead?
Expected is that order of kml documents in parse() method matches the order or 
parser's internal docs array.

What version of the product are you using? On what operating system?
Head of polys branch as of this issue entry: r62

Please provide any additional information below.
Example showing problem:
http://www.carolinamantis.com/issue46/index.html

Example showing modification:
http://www.carolinamantis.com/issue46/index.mod.html

Original geoxml3 r62:
http://www.carolinamantis.com/issue46/geoxml3.r62.js

Modded geoxml3:
http://www.carolinamantis.com/issue46/geoxml3.r62.mod.js

Diff file:
http://www.carolinamantis.com/issue46/diff.txt

The geoxml3.js that the files are using have additional log entries in them.  I 
have attached a diff of my change to this comment where the diff is only my 
code change, not the additional logging.

Original issue reported on code.google.com by fami...@gmail.com on 20 Dec 2011 at 2:55

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by geocodezip on 21 Dec 2011 at 12:55

GoogleCodeExporter commented 9 years ago
There may be an issue with your fix:
per:
http://www.w3schools.com/jsref/jsref_unshift.asp

The unshift() method is supported in all major browsers, except Internet 
Explorer.

Although it does seem to "work" in IE8, so perhaps that is no longer true.

MSDN says this:
http://msdn.microsoft.com/en-us/library/ezk94dwt(v=vs.94).aspx
Supported in the following document modes: Quirks, Internet Explorer 6 
standards, Internet Explorer 7 standards, Internet Explorer 8 standards, 
Internet Explorer 9 standards. 

and 
http://freewebdesigntutorials.com/javaScriptTutorials/jsArrayObject/unshiftMetho
d.htm
says it does work in IE
and stackoverflow agrees:
http://stackoverflow.com/questions/2197425/javascript-arrays

W3CSchools is really outdated, the unshift method is part of the ECMAScript 3rd 
Edition standard which was approved and published as of December 1999.
There is no reason to avoid it nowadays, it is supported from IE 5.5 up.

Considering it, seems like it should be OK.  I'll look at pulling in your fix.

Original comment by geocodezip on 21 Dec 2011 at 1:28

GoogleCodeExporter commented 9 years ago
Looking at the code, the doc order is being specifically reversed.  I don't 
know why.  It does seem that the order in parser.docs should be that of the 
provided array.

Original comment by geocodezip on 21 Dec 2011 at 2:28

GoogleCodeExporter commented 9 years ago
Thanks for accepting my report.  I used unshift because it was the quickest 
change.  I know that W3Schools is definitely not the best reference, but it is 
sometimes hard to avoid their SEO.  As fir the code, if using push is preferred 
(and it is what is used everywhere else), then changing the loop to count from 
0 to less than  internals.docset.length will work, and probably better.

Original comment by fami...@gmail.com on 21 Dec 2011 at 2:37

GoogleCodeExporter commented 9 years ago
fixed in revision 64
test case:
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_test_arrayorderB.html

Original comment by geocodezip on 26 Dec 2011 at 8:33

GoogleCodeExporter commented 9 years ago
Does anyone know if I call parse(singleURL) repeatedly will the docs order 
respect the order that parse was called?

Original comment by fitzy...@gmail.com on 18 Sep 2014 at 8:54