Ticket #3611 (new bug)

Opened 16 months ago

Last modified 16 months ago

Wrong DOM API calls to setAttributeNS()

Reported by: vog Owned by: ahocevar
Priority: major Milestone: 2.13 Release
Component: Renderer.SVG Version: 2.11
Keywords: setAttributeNS browser compatibility juniper ssl gateway Cc:
State: Needs More Work

Description

The SVG renderers (SVG and SVG2) make a wrong DOM API call to setAttributeNS(), which works in most cases due to tolerant browser implementations, but does not work in all circumstances.

In particular, this issue causes missing point markers when OpenLayers is accessed through the Juniper SSL Gateway, and the SVG or SVG2 renderer is used, and the point geometries are styled via externalGraphic.

Note that at other places (such as Format/WMC/v1.js) the correct API call to setAttributeNS() is used.

This issue exists in release 2.11 as well as in the master branch.

The attached patch fixes the issue. It was created via "git format-patch" against the master branch, but applies against release 2.11, too.

Please review.

Attachments

Change History

Changed 16 months ago by vog

Changed 16 months ago by ahocevar

  • state changed from Review to Awaiting User Feedback

According to the DOM Core specification,  setAttributeNS accepts a qualified name as 2nd argument. From the XML Namespaces specification,  qualified names: "Note that the prefix functions only as a placeholder for a namespace name. Applications should use the namespace name, not the prefix, in constructing names whose scope extends beyond the containing document.".

OpenLayers doesn't map the  http://www.w3.org/1999/xlink namespace to the "xlink" prefix, so this patch will cause problems in XHTML documents that map the xlink namespace to a different prefix. Having said that, the place to fix this is the Juniper SSL Gateway. Please close this ticket if you agree.

Changed 16 months ago by ahocevar

  • state changed from Awaiting User Feedback to Needs More Work

Well, there is one thing you could do in addition to the patch, which is mapping the xlink namespace to the "xlink" prefix in the svg root, by changing the createRenderRoot method. Something like this (untested):

    createRenderRoot: function() {
        var root = this.nodeFactory(this.container.id + "_svgRoot", "svg");
        root.setAttributeNS("http://www.w3.org/2000/xmlns/", "xlink", this.xlinkns);
        return root;
    },
Note: See TracTickets for help on using tickets.