[Proto-Scripty] Re: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-08-18 Thread Ken Snyder
Yes! The core devs do need to address whether or not this
Ajax.Request#getStatus() behavior will be fixed.
All non-HTTP requests (namely file:) return a status of 0. A function like
the following needs to be added, probably in Ajax.Request#getStatus()

isHttp: function() {
  var pcol = String(this.url).match(/^([a-z]+)?\:/i);
  if (!pcol) {
return window.location.protocol.match(/^https?\:/);
  }
  if (pcol[1] == 'http') {
return true;
  }
},

In my opinion, the status should be zero only on failure and an
onNetworkError or the like should be fired in place of on0 (Firing on0
seems kludgey). Other error status codes (such as 12002, 12007, 12029,
12030, 12031, 12152 and 13030) need to be mapped to a status of 0 and fire
onNetworkError (see Ajax: the Complete Reference by Thomas Powell -
http://books.google.com/books?id=p9hrjVMAeYkCpg=PA180 )

Then, as you mentioned, Ajax.Request#success() would then be  return
(status = 200  status 300);

With the current state of Prototype, you'll need to manually interpret a
success as a failure when the request is HTTP.

- Ken


On Fri, Jul 17, 2009 at 4:15 AM, T.J. Crowder t...@crowdersoftware.comwrote:


  Looks like success() returns TRUE all the time as foolged said.

 Yes, if getStatus returns 0 (either because the HTTP status code
 really came back from the browser as 0, or because the browser didn't
 supply one at all), then success will return true.  This has been
 noted before.[1][2]

 I'd love to hear from one of the core devs (NOT just someone active on
 this list like myself) *why* zero is considered success, because it
 doesn't make sense to me.  The server being offline is certainly not a
 successful outcome.  Most of the contributors to Prototype are not
 dumb, it's there for a reason, I just want to know what the reason is
 since they didn't feel it deserved a comment in the source.

 [1]
 http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-requests
 [2]
 http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/6d1d9fc7aa1e927a
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available


 On Jul 16, 1:52 pm, dmitrymos dmitry...@gmail.com wrote:
  Alex, what does success() return if getStatus() returns 0 in case of
  error?
 
  Looks like success() returns TRUE all the time as foolged said.
 
  On Jul 16, 7:37 am, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
 
 
 
   as it states...
 
   Return !status (NOT STATUS) || (OR) status greater than or equal to 200
   (TRUE|FALSE)  status LESS THAN 300
 
   as i said again it returns a true false
 
   - Original Message -
   From: foolged fool...@gmail.com
   To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
   Sent: Thursday, July 16, 2009 10:42 AM
   Subject: [Proto-Scripty] Re: checked !status in line 1496?
 
   (prototype-1.6.1.RC3)
 
Hi All
You do not understand my question.
I asked, not what is returned.
I asked what is checked! status?
 
IMHO rightly so.
return (status = 200   status 300);
 


--~--~-~--~~~---~--~~
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: checked !status in line 1496? (prototype-1.6.1.RC3)

2009-08-18 Thread Ken Snyder
yay!

On Tue, Aug 18, 2009 at 3:36 PM, Tobie Langel tobie.lan...@gmail.comwrote:


 An ajax revamp is planned for 2.0.

 Best,

 Tobie



--~--~-~--~~~---~--~~
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: .getHeight() is not a function

2008-11-27 Thread Ken Snyder
Be sure to extend the previousSibling element:

var prev = $(element).previousSibling
alert($(prev).getHeight())

- Ken

On Thu, Nov 27, 2008 at 8:53 AM, Diodeus [EMAIL PROTECTED] wrote:


 This code works in IE, bot for FF:

 var prev = $(element).previousSibling
 alert(prev.getHeight())

 In FF gives me prev.getHeight()) is not a function.

 Has FF gone mad? Have I?

 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Sortable container that copies (dragdrop clone/copy) instead of moves?

2008-11-21 Thread Ken

FYI, I also tried adding an onStartDrag event to the Draggable
elements, then doing a Sortable.destroy on the destination, then
making the destination Droppable w/ an onDrop event so I could clone
the element on the drop and then reactivate Sortable mode.
Seemed like a possible workaround, but the onDrop event never got
called.
Back to doing this with a few ugly Listboxes and buttons on the page
instead of cutesy DHTML...

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Sortable container that copies (dragdrop clone/copy) instead of moves?

2008-11-20 Thread Ken

I'm using Sortable.create on a few containers w/ div elements and
rather than moving a div from container1 to container2, I want to copy
and insert into container2.

Has anyone found an example of this?

The only bit I dug up is this:
http://markmail.org/message/2tuf3k3sw6gl3z2x

which would work if you create your own Draggable/Droppable elements,
but it'd be nice to have a Sortable container so that once something
is dropped, it can be rearranged.  It'd also be able nice to be able
to drop it at a specific point and have it land in the right place.

 thanks,

ken

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Creating New Dom elements with Prototype don't display in IE, hmm?

2008-11-18 Thread Ken Snyder
 yes, with tables in IE, you have to explicitly attach tr tags to a
tbody not a table

- Ken Snyder

On 11/18/08, Jonathan Rosenberg [EMAIL PROTECTED] wrote:


 Not much info to go on, but ... are you using tables?  If so, did you
 include tbody, tfoot  thead elements?

 --
 Jonathan Rosenberg
 Founder  Executive Director, Tabby's Place
 http://www.tabbysplace.org/


  -Original Message-
  From: prototype-scriptaculous@googlegroups.com [mailto:
 [EMAIL PROTECTED] On
  Behalf Of Outpost
  Sent: Tuesday, November 18, 2008 12:30
  To: Prototype  script.aculo.us
  Subject: [Proto-Scripty] Creating New Dom elements with Prototype don't
 display in IE, hmm?
 
 
  Hi,
 
  I am writing a simple calendar script. Using Prototype (1.6) I update
  the calendar's table creating and inserting new elements (TR, TD) for
  the days in to the DOM, applying Click Events to the TD along the way.
 
  The calendar works great on everything but IE(6,7), where the calendar
  simply disappears when it is initialized.
  In IE I have verified the new DOM elements have been created, they
  simply do not display in the browser, no errors reported by the
  browser either.
 
  If I change the script to generate the calendar as an HTML string and
  use the Element.update(htmStr) it displays in IE just fine, however I
  loose the ability to add Click Events to the calendar days while I
  generate the new calendar.
 
  Any ideas why IE simply will not display the new DOM elements?
 
  Any thoughts?
 
  Michael Klauss
 
 
 


 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Chrome, Object and each()

2008-11-14 Thread Ken Snyder
See my comments below. - Ken Snyder

On Fri, Nov 14, 2008 at 2:17 PM, laurin1 [EMAIL PROTECTED]wrote:


 I'm sorry. My brain is fried, it works on arrays with simple values,
 but not arrays with Objects IN them. Mispoke.

 For instance, in IE and in Chrome, this works fine:

$a = new Object();

$a['testme1'] = 'tested1';
$a['testme2'] = 'tested2';
$a['testme3'] = 'tested3';

$a.each(function($s){

alert($s);

});

Using Prototype convention:
a = $H();

a.set('testme1', 'tested1');
a.set('testme2', 'tested2');
a.set('testme3', 'tested3');

a.each(function(pair){
  alert(pair.key + ': ' + pair.value);
});




 In IE, this works fine, but does not work in Chrome:


$aEle = $('TicketOptions').getElementsByClassName('LoadChecks');

$aEle.each(function($s){

if($s != $sEle) $s.checked = false;

});

Using Prototype convention:

aEle = $('TicketOptions').select('.LoadChecks');
aEle.each(function(s) {
  if (s != sEle) s.checked = false;
});

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: delegating the event on document

2008-09-18 Thread Ken Snyder

david wrote:
 Hi Rauan,

 A question, does the focus effect bubble ??

 because this work:
 $(document.body).observe('click', function(e) {
 var _elem=Event.element(e);
 alert(_elem.tagName);
 return;
 });

 but not the same code when you use the focus event instead of the
 click event works.

 --
 david
   
That is correct.  The focus event does not bubble. 
(http://www.sitepoint.com/blogs/2008/07/23/javascript-event-delegation-is-easier-than-you-think/).

The article mentions you should not use event delegation for focus, 
blur, load, unload, or mousemove.

- Ken Snyder

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---