MozillaZine

SVG symbols do not fire onload event (only in firefox). I lo

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
mdtrooper
 
Posts: 1
Joined: March 8th, 2016, 1:29 am

Post Posted March 8th, 2016, 1:36 am

I am working with D3.js in a project to make a diagram with SVG. The diagram uses SVG symbols. And I have javascript code to manage these items with onload events.

In browsers such as webkit engine browsers runs very fine. But Firefox...Firefox does not run any onload event into a SVG.

Well, I saw the bug and thought Firefox is free software and these people loves the bugtracking. And I have uploaded the bug https://bugzilla.mozilla.org/show_bug.cgi?id=1254159.

And the response from these people is a "WONTFIX".

The example for to check the bug is tiny and clear:

Code: Select all
<html>
    <head>
        <title>test onload event in a svg symbol</title>
        <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
    </head>
    <body>
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" pointer-events="all" width="500px" height="500px" style="background: #ffff00;">
            <g class="cat" transform="translate(100 100)">
                <use xlink:href="animals.svg#cat" onload="javascript: console.log('This message is not showed in firefox.');" />
            </g>
        </svg>
        <script type="text/javascript">
            d3.select("svg")
                .append("g")
                    .attr("class", "dog")
                    .attr("transform", "translate(200 200) scale(0.5)")
                    .append("use")
                        .attr("xlink:href", "animals.svg#dog")
                        .on("load", function() {
                            console.log("And this message is not showed in firefox too.");
                        });
        </script>
    </body>
</html>


Finally, I look for in the w3c documents and the event onload in symbols are standard: https://www.w3.org/TR/SVG/struct.html#UseElement

Has anybody a workaround for this?

If somebody want karma points, I have opened a question in stackoverflow: http://stackoverflow.com/questions/3586 ... workaround

DanRaisch
Moderator

User avatar
 
Posts: 118013
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Post Posted March 8th, 2016, 5:55 am

Moving to Web Development.

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: Google [Bot] and 2 guests