bqbtoan / episodes

Automatically exported from code.google.com/p/episodes
0 stars 0 forks source link

EPISODES.measure bug in ex1.html #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using Chrome, load ex1.html without browser refresh (i.e. click on a link).

What is the expected output? What do you see instead?
EPISODES.measure doesn't work. It should.

What version of the product are you using? On what operating system?
0.2. Ubuntu 10.10. Chrome 9.0.597.94.

Please provide any additional information below.
It's because of the line

EPISODES.measure = function(en, st, en) { EPISODES.q.push( ["measure", en, st, 
en || new Date().getTime()] ); };

It has two parameters with the same name. This causes calls like

EPISODES.measure("jQuery", "jQuery Loading")

to fail because the first parameter is overwritten by the third, which is 
undefined.

For example:

>var test = function(en, st, en) { console.log(en, st, en); };
>test('a', 'b', 'c');
c b c

I fixed by changing the line to

EPISODES.measure = function(en, st, enOrT) { EPISODES.q.push( ["measure", en, 
st, enOrT || new Date().getTime()] ); };

This seems to fix it.

Original issue reported on code.google.com by chrisbre...@gmail.com on 14 Feb 2011 at 2:47

GoogleCodeExporter commented 9 years ago
This actually seems fine, I have also changed on my code.

name, st, en might be a better approach.

Original comment by abar...@gmail.com on 11 Mar 2011 at 8:12