[Proto-Scripty] Re: dom:loaded exceptions

2009-08-11 Thread Nicolas Terray

2009/8/10 Tobie Langel tobie.lan...@gmail.com:

 Relevant FF bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=503244

OK. Thanks :)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-10 Thread Nicolas Terray

2009/8/7 nlloyds nllo...@gmail.com:

 On Aug 6, 4:32 pm, mr_justin gro...@jperkins.otherinbox.com wrote:
 Don't call a method on an element unless it exists. This is a basic
 defensive coding technique.

 He gets this. His question is about why he does not receive an
 exception. I'm not sure, and now that I think about it, I may have had
 the same problem.

 Nicolas, have you tried your example with the latest RC of Prototype?

I've just tried with 1.6.1 RC3 and the behavior is the same. Should I
open a ticket or discuss about this bug on the core list?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-10 Thread Tobie Langel

I'm correctly seeing ann exception thrown in:

Safari 4.0.2
FF 3.0.13

However, it's no longer the case in FF 3.5.1.

It seems that the issue isn't related to the dom:loaded event in
particular, but to any fired custom event.

Here's a reduced testcase:

html
head
script type=text/javascript src=http://
prototypejs.org/assets/2009/6/16/prototype.js/script
script type=text/javascript
document.observe('foo:bar', function() { throw
'foo' });
document.fire('foo:bar');
/script
/head
body
/body
/html

Please open a bug report.

Thanks,

Tobie



On Aug 10, 11:15 am, Nicolas Terray nicolas.ter...@gmail.com wrote:
 2009/8/7 nlloyds nllo...@gmail.com:



  On Aug 6, 4:32 pm, mr_justin gro...@jperkins.otherinbox.com wrote:
  Don't call a method on an element unless it exists. This is a basic
  defensive coding technique.

  He gets this. His question is about why he does not receive an
  exception. I'm not sure, and now that I think about it, I may have had
  the same problem.

  Nicolas, have you tried your example with the latest RC of Prototype?

 I've just tried with 1.6.1 RC3 and the behavior is the same. Should I
 open a ticket or discuss about this bug on the core list?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-10 Thread Tobie Langel

This is definitely a FF issue.

Here's a reduced testcase without Prototype:

html
head
script type=text/javascript
document.addEventListener('click', function() { throw
'foo' }, false);
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
document.documentElement.dispatchEvent(event);
/script
/head
body
/body
/html

This should throw an error but doesn't in FF 3.5.1

On Aug 10, 6:30 pm, Tobie Langel tobie.lan...@gmail.com wrote:
 I'm correctly seeing ann exception thrown in:

 Safari 4.0.2
 FF 3.0.13

 However, it's no longer the case in FF 3.5.1.

 It seems that the issue isn't related to the dom:loaded event in
 particular, but to any fired custom event.

 Here's a reduced testcase:

 html
         head
                 script type=text/javascript src=http://
 prototypejs.org/assets/2009/6/16/prototype.js/script
                 script type=text/javascript
                 document.observe('foo:bar', function() { throw
 'foo' });
                 document.fire('foo:bar');
                 /script
         /head
         body
         /body
 /html

 Please open a bug report.

 Thanks,

 Tobie

 On Aug 10, 11:15 am, Nicolas Terray nicolas.ter...@gmail.com wrote:



  2009/8/7 nlloyds nllo...@gmail.com:

   On Aug 6, 4:32 pm, mr_justin gro...@jperkins.otherinbox.com wrote:
   Don't call a method on an element unless it exists. This is a basic
   defensive coding technique.

   He gets this. His question is about why he does not receive an
   exception. I'm not sure, and now that I think about it, I may have had
   the same problem.

   Nicolas, have you tried your example with the latest RC of Prototype?

  I've just tried with 1.6.1 RC3 and the behavior is the same. Should I
  open a ticket or discuss about this bug on the core list?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-10 Thread Tobie Langel

Relevant FF bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=503244
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-07 Thread nlloyds

On Aug 6, 4:32 pm, mr_justin gro...@jperkins.otherinbox.com wrote:
 Don't call a method on an element unless it exists. This is a basic
 defensive coding technique.

He gets this. His question is about why he does not receive an
exception. I'm not sure, and now that I think about it, I may have had
the same problem.

Nicolas, have you tried your example with the latest RC of Prototype?

Nathan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-07 Thread mr_justin

 He gets this. His question is about why he does not receive an
 exception. I'm not sure, and now that I think about it, I may have had
 the same problem.

Oh my bad, I was reading this all wrong. That is weird indeed, I had
never noticed that before.

It looks like a browser issue, not a Prototype issue. Tried in Firefox
and my code silently failed, but exceptions were raised in Safari and
IE as expected.

If I switched from document.observe('dom:loaded', ...) to Event.observe
(window, 'load', ...) then the exception was raised as expected in
Firefox.

-justin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-06 Thread Alex McAuley

In your first code $('toto') does not exist.
Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Nicolas Terray nicolas.ter...@gmail.com
To: prototype-scriptaculous@googlegroups.com
Sent: Thursday, August 06, 2009 12:47 PM
Subject: [Proto-Scripty] dom:loaded  exceptions



 Hello,

 ---
 html
 head
 script type=text/javascript src=prototype.js/script
 script type=text/javascript
 document.observe('click', function() { $('toto').update('1 2 3'); });
 /script
/head
 body
 /body
 /html
 ---


 If I click on the document, firebug raise the following exception:
 ---
 $(toto) is null
 ---

 Great!

 Now replace the 'click' event by 'dom:loaded' =
 ---
 html
 head
 script type=text/javascript src=prototype.js/script
 script type=text/javascript
 document.observe('dom:loaded', function() { $('toto').update('1 2 3'); });
 /script
/head
 body
 /body
 /html
 ---

 I expect the excepetion being raised during the load of the page.
 However it is caught somewhere and I don't get any excpetion. snif :(

 Is something wrong?
 Is there any workaround?

 Thanks,
 Nicolas Terray

 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-06 Thread Nicolas Terray

2009/8/6 Alex McAuley webmas...@thecarmarketplace.com:
 In your first code $('toto') does not exist.

Yes I know :D
My message is not about 'toto' but about exception catched by dom:loaded.
I do want my exceptions displayed by the browser. I don't want to add
a try{}catch in all dom:loaded

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: dom:loaded exceptions

2009-08-06 Thread mr_justin

Don't call a method on an element unless it exists. This is a basic
defensive coding technique.

var thing = $('toto');
if (thing) thing.update('some text');

// or in one line
$$('#toto').invoke('update', 'some text');

-justin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---