PDA

View Full Version : Anyone else fed up with Fx 3.x's inability to properly evaluate conditionals???



jay@moduscreate.com
22 Dec 2008, 8:46 AM
this bug is nasty and i hope the mozilla team farking fixes it soon! I know nige has posted issues, and i've spent HOURS trying to work around something as simple as:




var foundCols = [];
foundCols = this.colModel.getColumnsBy(function(srchCol) {
if (srchCol.header == colName && srchCol.id != colObj.id) {
return true;
}
return false;
}, this);

console.log(foundCols.length + ' --- ' + (foundCols.length > 0));
// 0 --- false


if (foundCols.length > 0) { evaluates to TRUE
found = true;
}



#(R*U#)(@*&()#DU*)(#*Y9872!!!
a
fwpo3p9u(P)#UY)(* $&@&)(*#&(@!!!!!!

Animal
22 Dec 2008, 8:56 AM
I can't produce a bug.

Running this code at the console produces expected results:



var foundCols = [];
console.log(foundCols.length + ' --- ' + (foundCols.length > 0));
if (foundCols.length > 0) {
alert("fark!");
}


It logs "0 --- false" and it does not alert anything.

jay@moduscreate.com
22 Dec 2008, 9:06 AM
yeah, it works in simple code ;). but in heavily nested, it's the exact opposite. I would post a video, but i cannot due to firewall restrictions :-\

GOIFJWEP(*#&)(*&@(!

jay@moduscreate.com
22 Dec 2008, 9:26 AM
It was *firebug* showing what it *thinks* it sees during a break point. disabling firebug from the tools>addons menu fixed the issue. oh boy!

Animal
22 Dec 2008, 9:28 AM
It's like quantum mekaniks innit?

Try to observe it, and you affect the outcome!

tryanDLS
22 Dec 2008, 9:36 AM
Just an FYI. I have an open bug w/testcase posted on the Firebug list. If anybody wants to see this in action, here's the testcase from the bug list


Here's a test case. I have found that this problem doesn't happen with simple vars,
but rather with properties of an object.

Also, there's another issue with editing of string properties. Each time you edit
and hit enter, it adds another layer of quotes wrapping the string.

When the breakpoint is hit, expand bar, doubleclick x - it changes to a string
'false'. Doubleclick again and hit enter - it adds another set of quotes to the
property.

The quoting issue can also be seen by editing z, a property that started as a string.

<!doctype html>
<html>
<head>
<title>test</test>
</head>

<body>
<p>Test</p>
</body>
<script type="text/javascript">
foo = function() {
var bar = {x:true, y:1, z:'123'};
debugger;
bar.y++;
if (typeof bar.x == 'string') {
alert('x is string');
}
};

window.onload = function() {
foo();
}

</script>
</html>