[jQuery] Clone not cloning HTML select options

2009-01-27 Thread Collin Allen

Hi all,

I'm running into a small problem with .clone() on select elements.  If
I create a simple HTML select with, say, 3 options, choose the middle
one, then clone the select, the resulting clone does not have the
middle option selected.  Yet, with other form elements, the various
chosen/selected attributes come with the clone and its children like
you'd expect.  I put together a bare-bones demo here:

http://www.command-tab.com/temp/clone.html

First choose B or C from the select, then click the Clone Select
button to clone that select and append it to the body.  Note that A is
selected, while the original select still has B or C selected.  (I get
the same results in Firefox 3 and IE 6, for what that's worth.)

Then, type some gibberish into the input on that page and click Clone
Input, and see that the value you entered IS part of the clone.  This
holds true for radio button groups and checkboxes.

Is there some reason selects don't work like the rest?

Thanks!


[jQuery] Re: OT: Firefox 3 RC1 for Mac

2008-05-19 Thread Collin Allen

Firefox 2 and 3 can co-exist so long as their app bundles are in
separate places (or even just named differently in the same place).
For example, I have FF 2.0 in /Applications, and FF 3.0rc1 in ~/
Applications/, my user's apps folder.  They share the same profile, so
you'll be doing a lot of extension-update-checking between launches,
but you might even be able to make a new profile for one or the other,
then use the -P command line switch to force each to use separate
profiles.  I'm not sure how to do that last bit on the Mac, though --
should be in Mozilla documentation somewhere...

HTH

~ Collin


On May 19, 2:18 pm, Shelane [EMAIL PROTECTED] wrote:
 Is there a way to install Firefox 3 RC1 without affecting FF2 on a
 Mac.

 The release notes have this message: Please note that installing
 Firefox 3 will overwrite your existing installation of Firefox on Mac
 OS X and Linux.

 I'm guessing that's if you simply install it into the Applications
 folder.  If I install it in another folder within the Applications
 folder, will it be ok?  If it's using this same directory for it's
 support files (~/Library/Application Support/Firefox) can it still
 affect FF2?

 I have to keep FF2 because it's the officially supported browser at
 work.  But I would love to install FF3 to start testing on my apps.


[jQuery] [Delegate] Does *every* event bubble up?

2008-04-17 Thread Collin Allen

When run, does jquery.delegate.js make every event bubble up to the
watched ancestor?  If so, why would one use something like LiveQuery
over a solution like delegate?  So far, I've only tested onclick and
onchange with delegate, but it's proving to be quite slick.

I ask because I'm developing a rather large web app and am curious
about (and this thinking may be totally crazy; if so please tell me)
watching the body tag or an overall wrapping div and catching
registered events as they bubble up with delegate.  Is this line of
thinking too out-of-the-ordinary?

Thanks again for all the help, folks!


[jQuery] Re: Does *every* event bubble up?

2008-04-17 Thread Collin Allen

  does jquery.delegate.js make every event bubble up to the
  watched ancestor?

 Nope.

Do you happen to know which events don't bubble up?

  why would one use something like LiveQuery
  over a solution like delegate?

 Event delegation introduces some weak points that one needs to
 overcome.
 LiveQuery should work reliably without requiring any special measures.

What kinds of weak points?

  I ask because I'm developing a rather large web app and am curious
  about (and this thinking may be totally crazy; if so please tell me)
  watching the body tag or an overall wrapping div and catching
  registered events as they bubble up with delegate.  Is this line of
  thinking too out-of-the-ordinary?

 You are not crazy and this technique is used/encouraged by other event
 delegation plugins already (Listen and Intercept), where the global
 call, uses the document as listener (implicitly).

Do Listen and LiveQuery poll the DOM for changes?  If not, how do they
keep event handlers up to date?

Thanks again for your input!  It's much appreciated.


[jQuery] Re: Does *every* event bubble up?

2008-04-17 Thread Collin Allen

That was all extremely useful and informative :-)  Exactly what I
needed to know.  Thanks!


[jQuery] Re: jqGrid final preview

2008-03-07 Thread Collin Allen

Wow, this plugin is quite impressive!  Nice job!


[jQuery] Re: what editor do you use?

2008-02-14 Thread Collin Allen

At home, I use TextMate under Mac OS X.

At work on a Windows XP box, I use a custom themed Notepad++, seen
here:
http://img169.imageshack.us/img169/6766/nppgd0.jpg


[jQuery] Re: What tool is used to minify the official jQuery distribution?

2008-02-07 Thread Collin Allen

This isn't the official tool (I'm not sure what is, maybe jsmin?), but
you might find it helpful/inspiring:

http://aciddrop.com/php-speedy/


On Feb 7, 12:44 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I've been testing out various minifying strategies, such as Dean
 Edwards' packer, YUI Compressor, jsmin, etc.  My goal is to
 concatenate all my required .js files and then minify them en masse.
 I've read of concerns about trailing semicolons, etc. and am curious
 what tool is used to minify the official jQuery distribution.  Please
 post if you have knowledge!

 Thanks,
 haylo


[jQuery] Re: What am I missing with jQuery Forms ajaxSubmit?

2008-02-06 Thread Collin Allen

Just to make sure, can you visit the target resource manually in
Firefox and not get the External dialog?  From the looks of it, it
seems like your server may be sending the wrong content-type, making
Firefox believe it's getting a file that should be downloaded instead
of parsed and rendered.


[jQuery] Re: [validate] error in jquery.validate.pack.js ie6

2008-02-06 Thread Collin Allen

I've also seen that IE6 error with the packed version of Validate.  I
assume it was something to do with the packing process, since the
minified and unpacked versions worked just fine.  However, the latest
version of Validate and jQuery do not appear to produce this problem
any longer.  Great work, Jörn!  Validate is one of my most-used
plugins :-)


[jQuery] jQuery 1.2.2 Event API

2008-01-16 Thread Collin Allen

Congrats jQuery Team on the release of 1.2.2!

I'm interested in the new Event API that was briefly mentioned in the
release notes -- is there a place for full (or in-progress)
documentation on it?  it sounds like the sort of thing that could be
quite useful in some current projects.

Thanks!


[jQuery] Re: Using JQuery with PHP Frameworks

2008-01-07 Thread Collin Allen

I've successfully used jQuery with Zend Framework and found it a nice
fit.  I made heavy use of their JSON encoder to get data back and
forth between the server and client side.

On Jan 7, 3:57 am, rics [EMAIL PROTECTED] wrote:
 Hello,

 I wish to start usign some PHP framework soon and was wondering wich
 one works better with JQuery. I will use Zend Framework or CakePHP.
 Not decided yet.

 Do you have any experience with one of them? How can I use JQuery with
 them? Any article or tutorial I can read?

 Thanks,
 rics


[jQuery] Re: 1.2.1 remove() forgets bindings?

2007-10-17 Thread Collin Allen

Cool, the native DOM .removeChild(x) worked as needed, but I just have
to be sure to make my code clean up after itself where necessary.
Thanks for the tip!

On Oct 17, 1:44 am, Wizzud [EMAIL PROTECTED] wrote:
 The change was deliberate, because most people use remove() to
 (literally) remove the element(s) in question, and any bound events
 were getting left behind in the jQuery data cache (along with any
 other element-assigned data held there) and possibly causing memory
 leakage.

 If you want to keep an element for possible later re-insertion then
 instead of removing it you might simply either hide() it in place, or
 create something like a trash bin (div id='trash'
 style='display:none;'/div) and move temporarily unwanted elements
 there.

 Alternatively, I *think* you could use the native removeChild() method
 on the element, store the return, and later re-insert it (natively
 again). This would leave jQuery's data cache in place for the element
 so any bound events or element-assigned data *should* still be there.
 Of course, you could then be incurring the same probability of memory
 leakage that the change was put in place to prevent!

 On Oct 16, 11:21 pm, Collin Allen [EMAIL PROTECTED] wrote:

  Hello again all!

  I just upgraded one of my web apps to jQuery 1.2.1, and noticed
  that .remove() no longer retains event handler bindings (i.e., if I
  have a .click() bound to an element). Previously, I was assigning the
  the return value of .remove() to a variable to stash a small chunk of
  the page in memory, and append it back in later on. In jQuery 1.1.2, I
  could recall it from memory, complete with previously bound click
  events and all, but in 1.2.1 it doesn't appear to work that way. Is
  there a better way to go about this and make it work in 1.2.1?

  Thanks for your continued support for such a great library!

  (Apologies if this shows up twice -- my initial post didn't appear,
  even after a few hours...)



[jQuery] 1.2.1 remove() forgets bindings?

2007-10-16 Thread Collin Allen

Hello again all!

I just upgraded one of my web apps to jQuery 1.2.1, and noticed
that .remove() no longer retains event handler bindings (i.e., if I
have a .click() bound to an element).  Previously, I was assigning the
the return value of .remove() to a variable to stash a small chunk of
the page in memory, and append it back in later on.  In jQuery 1.1.2,
I could recall it from memory, complete with previously bound click
events and all, but in 1.2.1 it doesn't appear to work that way.  Is
there a better way to go about this and make it work in 1.2.1?

Thanks for your continued support for such a great library!



[jQuery] 1.2.1 remove() forgets bindings?

2007-10-16 Thread Collin Allen

Hello again all!

I just upgraded one of my web apps to jQuery 1.2.1, and noticed
that .remove() no longer retains event handler bindings (i.e., if I
have a .click() bound to an element). Previously, I was assigning the
the return value of .remove() to a variable to stash a small chunk of
the page in memory, and append it back in later on. In jQuery 1.1.2, I
could recall it from memory, complete with previously bound click
events and all, but in 1.2.1 it doesn't appear to work that way. Is
there a better way to go about this and make it work in 1.2.1?

Thanks for your continued support for such a great library!

(Apologies if this shows up twice -- my initial post didn't appear,
even after a few hours...)



[jQuery] Re: jQuery 1.2.1 is auto evaling scripts from AJAX before DOM is ready

2007-09-18 Thread Collin Allen

Could you possibly put a $(document).ready(function(){ ... }); inside
the script for the incoming page, or does that fire right away, too?


On Sep 18, 5:46 am, John Resig [EMAIL PROTECTED] wrote:
 There was another issue who was having the same problem as you, with
 1.2.1, I recommend doing this inside your script, at least until I
 can get a fix in.

 script type=text/javascriptsetTimout(function(){ ... your code ...

 }, 13);/script

 --John

 On 9/17/07, benjam [EMAIL PROTECTED] wrote:



  I have a script that runs a clickable calendar date field, and this
  script is being called in a form that is passed through AJAX.

  When the form html is returned from the AJAX script, it is added to
  the page and displayed.

  The problem is that the script (which cames after the input field it
  is referring to) is trying to look for said input field and is failing
  to find it.  This leads me to believe that the javascript is being run
  before the html has been fully integrated into the page, which is also
  why there is nothing shown on the page when the errors pop up.

  Here is a sample of the script that is being run:
  input name=startedDate id=f-calendar-field-8da04fa6e1
  class=datedDate value=1969-12-31 type=text /a href=# id=f-
  calendar-trigger-8da04fa6e1img border=0 src=./jscalendar/
  calendar.png alt=Select Date //ascript type=text/
  javascriptCalendar.setup({ ifFormat : %Y-%m-%d, daFormat : %Y/
  %m/%d, firstDay : 0, showOthers : true, inputField : f-
  calendar-field-8da04fa6e1, button : f-calendar-
  trigger-8da04fa6e1} );/script

  Is there a way to delay eval of the scripts until after the html
  content has been integrated into the page?



[jQuery] Re: Best Practice? Sliding table rows up and down

2007-09-17 Thread Collin Allen

One of the issues I ran into with animating tables (specifically,
TRs), is that jQuery appears to change the 'display' style from table-
row to block while animating, resulting in the row breaking completely
while animating, then popping back into place when the animation is
complete.  I'd love to see a workaround for this which maintains the
alignment of headings in the THEAD section.



[jQuery] Unavoidable Duplicate DOM IDs?

2007-09-07 Thread Collin Allen

I'm currently working on a project where different areas of the user
interface (an AJAX-loaded Service) are intended to be re-usable,
potentially with more than one instance of a given Service on a
page.  The issue I'm running into, and am asking for some input on, is
the following:

When I load one instance of a Service into the page, there are DOM IDs
on a number of tags.  That's easy enough.  I can hook them with jQuery
all day long and everything is peachy.  However, when I load a second,
duplicate Service on the page into another area, the DOM IDs of the
two Services collide.

I can still hook elements with jQuery by being more specific $(#area1
#service) and $(#area2 #service), but I realize this isn't valid
HTML.  I can't think of another solution, though.  Is there any way to
have a significant amount of content on a page that overlaps, but not
have their IDs collide, yet still offer clean CSS selectors and DOM
references for jQuery?  The Services also bring in their own
JavaScript, which is why each instance needs to be able to reference
itself, without getting only the first occurrence of an ID that exists
on a page.

I hope I'm being specific enough...  If not, I can surely provide a
small example.

Thanks once again!



[jQuery] Re: Unavoidable Duplicate DOM IDs?

2007-09-07 Thread Collin Allen

After sitting and thinking about it over lunch, that was my thinking,
too.

The purpose of classes is for styles/behaviors/identifiers that are
spread across multiple occurrences of an item.  (Full detail: I'm
working on this project with some PHP engineers at work, and they're
completely OK with using multiple DOM IDs on a page simply because it
works already, and they can access the IDs by being more specific
like #area1 #service1 in their JavaScript hooks).  Going classes-
only with re-usable Services would work, but for some elements, an ID
becomes more important.  Case in point: input text boxes.  Generally,
they have a name and ID, but if two Services are loaded with the same
content, the IDs overlap -- and who knows what will break.

I'm against using duplicate IDs on any page just because I learned the
W3C standards and what's good practice and what's not.  Aside from
using classes as semi-unique identifiers, I can't see a way around the
dilemma...


On Sep 7, 12:38 pm, Benjamin Sterling
[EMAIL PROTECTED] wrote:
 Collin, You should be able to get away with using classes instead
 $('.service')  and you can grab each instance like (I could be wrong on this
 option) $('.service')[0] or $('.service')[1] or you can do
 $('service:eq(0)') and $('service:eq(1)') and then you have the slice method
 which is a little harder to explain, but is just like using the javascript
 slice method.

 On 9/7/07, Collin Allen [EMAIL PROTECTED] wrote:





  I'm currently working on a project where different areas of the user
  interface (an AJAX-loaded Service) are intended to be re-usable,
  potentially with more than one instance of a given Service on a
  page.  The issue I'm running into, and am asking for some input on, is
  the following:

  When I load one instance of a Service into the page, there are DOM IDs
  on a number of tags.  That's easy enough.  I can hook them with jQuery
  all day long and everything is peachy.  However, when I load a second,
  duplicate Service on the page into another area, the DOM IDs of the
  two Services collide.

  I can still hook elements with jQuery by being more specific $(#area1
  #service) and $(#area2 #service), but I realize this isn't valid
  HTML.  I can't think of another solution, though.  Is there any way to
  have a significant amount of content on a page that overlaps, but not
  have their IDs collide, yet still offer clean CSS selectors and DOM
  references for jQuery?  The Services also bring in their own
  JavaScript, which is why each instance needs to be able to reference
  itself, without getting only the first occurrence of an ID that exists
  on a page.

  I hope I'm being specific enough...  If not, I can surely provide a
  small example.

  Thanks once again!

 --
 Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com



[jQuery] Re: Image rollover plugin?

2007-09-06 Thread Collin Allen

Unless it's something complicated, CSS is usually the way to do it and
avoid scripting altogether.  Note that you can change more than one
element's style using a little CSS trick:

a:hover {
   /* change the A tag style */
}
a:hover span {
   /* change the SPAN inside the A, including the A style above */
}

Works in FF, IE6+, Opera, Safari, and more :-)

~ Collin


On Sep 6, 11:09 am, howa [EMAIL PROTECTED] wrote:
 Something like what dreamweaver provide, are there such as plugin in
 jQuery?

 Thanks.



[jQuery] Re: select .change event not firing on up/down arrow press

2007-08-03 Thread Collin Allen

When the user has changed the value with the keyboard, it will fire
the change event when it loses focus. (I think that's right..)


On Aug 3, 3:16 am, Jack Killpatrick [EMAIL PROTECTED] wrote:
 Hi, wondering if anyone knows why this might be happening:

 I've attached a .change event to a set of select boxes:

 $('#ml_cartItems [EMAIL PROTECTED]').change(function() {
 var productID = this.id.split('_')[1];
 MLStore.changeItemQty( productID, $(this).val() );
 });

 The change event fires fine when the user changes the select box using
 the mouse, but not when the keyboard up/down arrow keys are used. Know why?

 Related question the MLStore.changeItemQty() function makes an ajax
 call. I don't want a user tooling up and down the select box, causing it
 to fire a slew of ajax calls. Any advice on how to handle that
 situation? I don't want to use blur, because I want the (eventual) ajax
 call to be fired just by changing the select box. I figure I can use a
 setTimeout or setInterval, but not sure what the most elegant way would be.

 TIA!
 Jack



[jQuery] Re: Infinite animations

2007-07-29 Thread Collin Allen

Morphing from color to color should be possible, perhaps by modifying
the CSS background-color property using rgb(x,y,z) values.  You could
increment each value individually, or each in a repeating sequence.
I'm not sure value changing method would produce the most visually
pleasing results, but that would be something to tinker with.
Alternatively, you could (again) use a 1x1 pixel animated gif fading
from R to G to B (using three layers and tweening in ImageReady), and
letting the background-repeat property tile it in both X and Y
directions.  The latter would be much less CPU intensive, making your
script that much more lightweight.

Hope that helps!

--
Collin Allen
www.command-tab.com


On Jul 29, 12:48 am, Kia Niskavaara [EMAIL PROTECTED]
wrote:
 On 7/29/07, Sean Catchpole [EMAIL PROTECTED] wrote:



  It would be very easy to create a repeating animation, simply call the
  same animation again the callback function.

 Thanks.

 More importantly, I believe that this is a prefect situation for a gif

  animation. Doing javascript animations is very hard for the browser
  and slows down old computers. Gifs have been used for a long time so
  browsers are quite good at drawing them.

 In my scenario, jQuery is already loaded, so there will be no extra loading
 time. I was also thinking that a basic text Please wait, loading could be
 animated in a simple way. Maby by cycling some colors, slowly. I don't think
 that it will slow down any old computer.

 Can the animate() function morph between colors?



[jQuery] Animate bug under IE6?

2007-07-20 Thread Collin Allen

Hey all -- I'm new to the list (but not so new to jQuery), and was
hoping I could get some assistance regarding what appears to be a bug
in the .animate function when running under IE6.  Inside a .click
function assigned to a specific anchor tag, I call .animate using
jQuery 1.1.3.1.  It works in Firefox and Safari, but IE6 reports a
runtime error.  When I switch to jQuery 1.1.2, it works (mostly).  The
first animate sequence doesn't slide, but merely re-draws when the
final frame is done, but all subsequent animations work fine.

Perhaps this is due to my standalone IE6 (from evolt), as I've seen it
have other weird problems with JS, too.  I'm running IE7 installed,
unfortunately.

Any suggestions would be greatly appreciated!

I've posted a demo of the issue at the following location (sans a few
images):
http://www.command-tab.com/jquery/animate_bug/

Thanks!