Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#2031 closed defect (fixed)

Errors with xml/Parse.js on IE6 and IE7

Reported by: luke dot arms at inspiriti dot com dot au Owned by: morris
Priority: high Milestone: 0.9
Component: General Version: 0.4.1rc1
Keywords: Cc:
Blocked By: Blocking:

Description

JavaScript? errors are thrown by the getDojoTagName function in xml/Parse.js, as of 0.4.1rc1 (same bug on earlier versions).

Adding a check for node.scopeName resolves the issue, as below.

=============== 67c67 < if(dojo.render.html.capable && dojo.render.html.ie && node.scopeName != 'HTML'){ ---

if(dojo.render.html.capable && dojo.render.html.ie &&

typeof(node.scopeName) != 'undefined' && node.scopeName != 'HTML'){

===============

Cheers.

Attachments (2)

test.html (767 bytes) - added by luke dot arms at inspiriti dot com dot au 13 years ago.
contains script
data.xml (1.1 KB) - added by sample data 13 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 13 years ago by bill

Testcase?

comment:2 Changed 13 years ago by luke dot arms at inspiriti dot com dot au

I presume you mean you need to see some code that fails? (Sorry, this is my first time participating here. Please fill me in if there's anything else I should do to make this easier, as I hope to be more involved.) Ok, here goes:

<script language="javascript" src="../iwaf/php/iwaf/scripts/dojo/dojo.js"></script>
<script language="javascript">
dojo.require("dojo.xml.*");

function orgSelected (org) {

    dojo.io.bind({
        url: "../Ajax/Request.php?rid=sql_select_wm_individual&orgkey=" + org,
        load: processOrgResult,
        method: "POST",
                error: function (type, error) {
                alert("Error processing request for individuals: " + error);
        },
        mimetype: "text/xml"
        });

}

function processOrgResult (type, data, evt) {

    var parser = new dojo.xml.Parse();

    var xml = parser.parseElement(data.getElementsByTagName("response")[0]);

    ...
}

...

orgSelected is triggered by a select box onchange event. The parser.parseElement line fails, even though the XML returned is valid and the "response" element is being looked up correctly. I debugged using Visual Studio and found the failure in the line mentioned originally, because scopeName wasn't defined on the elements.

I'll repost the fix using WikiFormatting:

67c67
< 		if(dojo.render.html.capable && dojo.render.html.ie && node.scopeName != 'HTML'){
---
> 		if(dojo.render.html.capable && dojo.render.html.ie && 
> typeof(node.scopeName) != 'undefined' && node.scopeName != 'HTML'){

Changed 13 years ago by luke dot arms at inspiriti dot com dot au

Attachment: test.html added

contains script

Changed 13 years ago by sample data

Attachment: data.xml added

comment:3 Changed 13 years ago by luke dot arms at inspiriti dot com dot au

Proper test case attached.

Sorry about the description on the XML file ... but I can't fix it :-(

comment:4 Changed 13 years ago by luke dot arms at inspiriti dot com dot au

Hi,

Sorry for the botch-up I've made of this bug report ;-) The next one will be much neater. Meanwhile, just wanted to add that this bug is still a problem in 0.4.1 and the same fix still works.

Cheers.

comment:5 Changed 13 years ago by bill

Milestone: 0.5
Owner: changed from anonymous to morris

comment:6 Changed 13 years ago by morris

Problem not repeated, but fix is sane and I tested it.

Fixed in 6882.

comment:7 Changed 13 years ago by bill

Resolution: fixed
Status: newclosed

comment:8 Changed 12 years ago by luke dot arms at inspiriti dot com dot au

Just confirming that this code is still broken in 0.4.2 even though it appears to have been cleaned up.

I have since read further documentation on comparisons with undefined variables and if my understanding is correct, code like this will break if it is not possible to convert the variable to a string via toString:

if (myUndefinedVar == "something") {

...

}

So this fix is still important. Not sure why it wasn't included in 0.4.2 given it's been fixed for 3 months already ...

I'd appreciate it if someone could assure me that this fix will be included in the next release.

Note: See TracTickets for help on using tickets.