Closed Bug 374308 Opened 17 years ago Closed 10 years ago

SVG load event does not fire when enclosing display attribute changed from "none" to ""

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: duncan.loveday, Unassigned)

Details

(Keywords: regression)

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a3pre) Gecko/20070316 Minefield/3.0a3pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a3pre) Gecko/20070316 Minefield/3.0a3pre

An SVG document included via <OBJECT> or <EMBED> within an HTML <DIV> with style="display:none" does not fire the SVG load event if the enclosing <DIV> has its style.display attribute updated to "".

Reproducible: Always

Steps to Reproduce:
1. Place the attached noLoad.html and noLoad.svg in a directory
2. Open noLoad.html in Firefox
3.
Actual Results:  
The following alert message is displayed: "loadSVGBody"

Expected Results:  
The following alert message should be displayed: "loadSVGBody" and "loadSVG" (ordering not guaranteed).

Works correctly on FF2.

A workaround for <EMBED> only (not <OBJECT>) is to also set style.display on the <EMBED> to ""

Within the test case there are comments relating to this workaround.
On re-running this test case I found it was working for <EMBED> even without the workaround....I was a little overzealous in providing a minimal test case.

My original problem is with <EMBED> and to illustrate this the test case has to include the <EMBED> via scripting (document.writeln('<EMBED....');) and the scripting also has to be in an external file, not inlined.

So there are three attachments now, the HTML source, the external script file that writes the <EMBED> and the SVG source.

With this setup, the workaround I outlined does NOT help.

Changing <EMBED> to <OBJECT> in this test case does NOT make it work, i.e. same problem exists with <OBJECT>. It's actually easier to break <OBJECT> than to break <EMBED>.
Attached file test HTML source
Attached image test SVG source
Keywords: regression
To clear up what has become a pretty confusing bug report (sorry about that) my observations are

                                       FF2                   FF3
OBJECT tag   Not scripted              No load event         No load event
EMBED tag    Not scripted              Fires load event      Fires load event
OBJECT tag   Scripted inline           No load event         No load event
EMBED tag    Scripted inline           Fires load event      Fires load event
OBJECT tag   Scripted out of line      No load event         No load event
EMBED tag    Scripted out of line      Fires load event      **No load event**


By "Not scripted" I mean the HTML source contains one of

    <embed ......></embed>
    <object .....></object>

By "Scripted inline" I mean the HTML source contains one of

    <script language="javascript">
    document.writeln('<embed .....></embed>');
    </script>

    <script language="javascript">
    document.writeln('<object .....></object>');
    </script>

By "Scripted out of line" I mean the HTML source contains

    <SCRIPT LANGUAGE="javascript" src="noLoadWriteEmbed.js"></SCRIPT>

and file NoLoadWriteEmbed.js contains one of

    <embed ......></embed>
    <object .....></object>

To summarise, the OBJECT tag never fires an onload event when the display attribute on the enclosing <DIV> changes from "none" to "" and this was also the case with FF2 so that is not a regression - don't know if it is correct behaviour or not but it is consistent.

On the other hand, EMBED does fire onload events consistently in the same scenario with FF2 but this only works with FF3 in a subset of cases, namely where inline scripting or no scripting is used. Again, I don't know if this is correct behaviour but it is a regression in the sense that out of line scripting worked on FF2 but does not work on FF3. That's the specific scenario that breaks my app in FF3.

The workaround I spoke of earlier, changing the display attribute on the OBJECT or EMBED itself instead/as well as on the enclosing DIV, is a *red herring* and makes no difference in any of the above scenarios - I must have been failing to refresh pages properly or some other incompetence, my apologies for that.
Dammit....meant to say

By "Scripted out of line" I mean the HTML source contains

    <SCRIPT LANGUAGE="javascript" src="noLoadWriteEmbed.js"></SCRIPT>

and file NoLoadWriteEmbed.js contains one of

    document.writeln('<embed .....></embed>');
    document.writeln('<object .....></object>');
Dropped the severity of this to minor since it will only affect people who incorporate SVG in obscure ways an who also using "display:none" to hide the content. The problem is also easy to work around by getting the out of line script to write or not write the <OBJECT> or <EMBED> rather than using the "display:none" attribute.

FWIW there is a specific reason why people might want to incorporate SVG via an out-of-line scripted <EMBED>, namely to workaround an annoying "Click to activate and use this control" message in IE6/7, see http://msdn.microsoft.com/workshop/author/dhtml/overview/activating_activex.asp?frame=true#loading if interested.
Severity: normal → minor
Assignee: general → nobody
QA Contact: ian → general
Seems to work now.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: