Using document.evaluate with an XPath targeting a namespaced attribute does not return the expected result

Fixed, not yet flighted Issue #3739767

Details

Created
Jul 29, 2015
Privacy
This issue is public.
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Additional test case:

The test case is available at (just open the F12 Console to
see the output in different browsers):

http://ietest.azurewebsites.net/edge/2/


URL:

Repro Steps:

Small testcase:


<html>
<body>
<div xmlns:c="c-namespace" attribute="should NOT be in result 1" c:attribute="should be in result 1"></div>
<c:div xmlns:c="c-namespace" attribute="should NOT be in result 2" c:attribute="should be in result 2"></c:div>
<div xmlns="c-namespace" xmlns:c="c-namespace" attribute="should NOT be in result 3" c:attribute="should be in result 3"></div>
</body>
<script type="text/javascript">
var lookupNamespaceURI = function lookupNamespaceURI(prefix)
{
var namespaces = {
"c-prefix-in-xpath": “c-namespace”
};

        var namespace = namespaces[prefix];

        return namespace;
    };

    var namespaceResolver = {
        lookupNamespaceURI : lookupNamespaceURI
    };

    var documentString = document.documentElement.outerHTML;

    var xmlDocument = (new window.DOMParser()).parseFromString(documentString, "text/xml");

    var result = xmlDocument.evaluate("//@c-prefix-in-xpath:attribute", xmlDocument, namespaceResolver, XPathResult.ANY_TYPE, null);

    var node = null;

    while (node = result.iterateNext())
    {
        console.log('Found node in namespace "' + node.namespaceURI + '", with name "' + node.localName + '", and value "' + node.nodeValue + '".');
    }
</script>

</html>

Expected Results:

It is expected that the attributes in the specified namespace are returned.

“XML": <element prefix:myAttribute="targeted, but not returned” myAttribute="not targeted, but returned" />
When the XPath is "@prefix:myAttribute", prefix:myAttribute should be returned.

In the test case, it is expected that the result only contains the (three) attributes that are in the “c-namespace” namespace.

Actual Results:

Dev Channel specific:

No

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Mara P.”

      Changed Assigned To to “Travis L.”

      Changed Assigned To from “Travis L.” to “Thomas M.”

      Changed Status to “Confirmed”

      Changed Status from “Confirmed”

      Changed Status to “Confirmed”

      Changed Steps to Reproduce

      Changed Status from “Confirmed” to “In progress”

      Changed Status from “In progress” to “In code review”

      Changed Status from “In code review” to “In progress”

      Changed Status from “In progress” to “In code review”

      Changed Status from “In code review” to “In progress”

      Changed Assigned To from “Thomas M.” to “IE S.”

      Changed Status from “In progress” to “Fixed”

      Changed Status from “Fixed” to “Fixed, not yet flighted”

    You need to sign in to your Microsoft account to add a comment.

    Sign in