Skip to content

Undefined var #37

@dwploc

Description

@dwploc

Parsing a gpx that has two link nodes within the Metadata

Hills

xxx

`/**

  • Search the value of a direct child XML DOM element

  • @param {Element} parent - Parent DOM Element

  • @param {string} needle - Name of the searched element

  • @return {} The element value
    */
    gpxParser.prototype.queryDirectSelector = function(parent, needle) {

    let elements = parent.querySelectorAll(needle);
    let finalElem = elements[0];

    if(elements.length > 1) {
    let directChilds = parent.childNodes;

     for(idx in directChilds) {    <--- idx is undefined.  
         elem = directChilds[idx];
         if(elem.tagName === needle) {
             finalElem = elem;
         }
     }
    

    }

    return finalElem;
    };`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions