[jquery-dev] Re: $.fn.add(selector) and context

2009-10-30 Thread Robert Katić
Sorry, I posted an old version of code. Here the new one: jQuery.fn.add = function( selector, context ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), typeof selector === string ? jQuery( selector, context || this.context

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread gMinuses
It's very detailed, thank you for the demos! But I don't quite understand the purpose of them. If you are saying $.map() shouldn't work on objects because wrapping functions is not a good practice, then $.map() should also not work on arrays. Here is why: // options now is a sequence var options

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread Robert Katić
But making map() functions work on hashes makes sense, so why rule them out? There are at least three reasons why this is not a good idea: 1. $.map() is not a real general purpose map function. If callback returns an array then its items will be values because in same cases it is convenient

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread gMinuses
1. $.map() is not a real general purpose map function. If callback returns an array then its items will be values because in same cases it is convenient that a callback can returns multiple values. So if you make $.map() generic for all hashes than you would $.map() generic for all sequences

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread Robert Katić
var hash = { a: 1, b: 2 } $.map( hash, function( val, key ) {     if( key === 'a')         return { c: 3, d: 4 };     else         return val; }); And now hash is { c: 3, d: 4, b: 2 }. It doesn't conflict with anything. Can you explain which objects you expect would extend the final

[jquery-dev] Re: $(nodeList) and comment nodes

2009-10-30 Thread Robert Katić
To be more accurate, $([]).add( nodeList ) can not contains comment nodes only on IE. This makes it even more ambiguous, with unexpected results. Also it seams that the only expected NodeList is from an getElementsByTagName.call. I know that it is not explicitly supported by the API, but

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread gMinuses
Can you explain which objects you expect would extend the final object, and which object would not? (nodes are objects too) I think it should make the following expression evaluate to true: object object.constructor === Object ( I'm not sure if it's strict enough, but what I mean is that the

Re: [jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread Scott Sauyet
On Fri, Oct 30, 2009 at 8:37 AM, gMinuses gminu...@gmail.com wrote: If your argument is scoping, it is not enough. I don't quite understand what your are saying, could you be more specific? The main point, I think, is that you have not convinced either of us of the worth of your proposed

Re: [jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread Scott Sauyet
On Fri, Oct 30, 2009 at 2:22 AM, gMinuses gminu...@gmail.com wrote: It's very detailed, thank you for the demos! But I don't quite understand the purpose of them. I was trying desperately to come up with some real-world use of your suggestion, and noted that your example used callbacks, and I

Re: [jquery-dev] Re: $(nodeList) and comment nodes

2009-10-30 Thread John Resig
I think you're right here - I'm not completely convinced that this distinction still needs to exist. Could you file a ticket? Thanks. --John On Fri, Oct 30, 2009 at 7:47 AM, Robert Katić robert.ka...@gmail.com wrote: To be more accurate,  $([]).add( nodeList  ) can not contains comment

Re: [jquery-dev] Re: $.fn.add(selector) and context

2009-10-30 Thread John Resig
This seems reasonable, as well. Can you file a ticket? Thanks. --John On Fri, Oct 30, 2009 at 2:06 AM, Robert Katić robert.ka...@gmail.com wrote: Sorry, I posted an old version of code. Here the new one: jQuery.fn.add = function( selector, context ) {    return this.pushStack(

Re: [jquery-dev] Re: $.fn.add(selector) and context

2009-10-30 Thread Scott Sauyet
       || this.context (this.context.ownerDocument || this.context) There's something -- let's say redundant -- about this line. :-) -- Scott (a (b || a)) == a -- You received this message because you are subscribed to the Google Groups jQuery Development group. To post to this group,

Re: [jquery-dev] Re: $.fn.add(selector) and context

2009-10-30 Thread Scott Sauyet
On Fri, Oct 30, 2009 at 10:34 AM, Scott Sauyet scott.sau...@gmail.com wrote: There's something -- let's say redundant -- about this line.  :-) Ignore me. Brain fart. -- Scott -- You received this message because you are subscribed to the Google Groups jQuery Development group. To post to

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread Robert Katić
I think it should make the following expression evaluate to true: object object.constructor === Object ( I'm not sure if it's strict enough, but what I mean is that the object should be constructed by Object ) This is technically a more complex problem then you think. There was an John

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread gMinuses
OK, the real-world use is this: I'm writing a plugin for jquery that implements mvc pattern, and it works like this: Define a model: $.mvc.model({ myModel: { myMethod: function() {} } }); Define a controller and call a model from the controller: $.mvc.controller({

Re: [jquery-dev] Re: $(nodeList) and comment nodes

2009-10-30 Thread Karl Swedberg
I came across an oddity with jQuery.merge from a completely different route -- looking through jQuery.support properties. It looks like jQuery.merge is testing for jQuery.support.getAll, but I can't for the life of me find anywhere in the source where jQuery.support.getAll is being

Re: [jquery-dev] Re: $(nodeList) and comment nodes

2009-10-30 Thread John Resig
Eww... It must've been accidentally cut in the last release - but we didn't notice because the worst case is only a minor perf hit. Well, it makes it pretty easy to actually just remove it then! (Especially if the only place where it's being used internally is in this soon-to-be-stripped method.)

Re: [jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread Scott Sauyet
On Fri, Oct 30, 2009 at 11:13 AM, gMinuses gminu...@gmail.com wrote: OK, the real-world use is this: I'm writing a plugin for jquery that implements mvc pattern, and it works like this: [ ... ] $.mvc.controller({    myController: {        myAction: function() {            // Pass in a

[jquery-dev] Re: Traversing the title element and accessing the content.

2009-10-30 Thread Van
Thanks, Karl. I didnt know that the title element was treated as a special case and was selecting it using jQuery's $('title') selector syntax. That failed miserably in IE7. Changing my code to use document.title as you suggested solved the problem. On Sep 11, 9:08 am, Karl Swedberg

[jquery-dev] Re: Using JQuery with WordPress

2009-10-30 Thread Eric Martin
Here's something I wrote that will give you a place to start: http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/ You'll want to make sure not to use $(document)..., because WordPress calls jQuery.noConflict();. To your other question, I suggest adding the code into an external js

[jquery-dev] Table cell selector issue in IE8

2009-10-30 Thread Eric Martin
This issue has already been reported in Trac[1], but I just wanted to mention it here. In IE8 (not using compatibility mode), the :hidden and :visible selectors do not work on table cells. The Trac page has a couple test pages, but in general, these selectors fail: $('td:hidden') and

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread gMinuses
Thanks! Now I'm convinced. I never thought it's going to be that complicated. Maybe I just should stick with for( key in object ). On Oct 30, 10:42 pm, Robert Katić robert.ka...@gmail.com wrote: I think it should make the following expression evaluate to true: object object.constructor ===

[jquery-dev] Should jQuery normalize this IE6 bug involving input/ names?

2009-10-30 Thread brianpeiris
The alerts in following code do not show the same result in IE6 due to a bug[1] (also discussed on stackoverflow.com[2]). $('input type=hidden /').attr('name', 'foo').appendTo (document.body); alert(document.getElementsByName('foo').length); // Alert shows 0 in IE6 and 1 in other browsers

[jquery-dev] Re: Should $.map() also work for objects?

2009-10-30 Thread gMinuses
Since implementing a $.map() working on objects is not an easy task, I've given up the idea. BTW, here is the project if you are interested: http://github.com/gminuses/jquerymvc. Regards On Oct 31, 12:49 am, Scott Sauyet scott.sau...@gmail.com wrote: On Fri, Oct 30, 2009 at 11:13 AM, gMinuses

[jquery-dev] ajax options parameter

2009-10-30 Thread Markw65
The ajax options parameter, unlike every other(?) options parameter, is used in place. ajax: function( s ) { // Extend the settings, but re-extend 's' so that it can be // checked again later (in the test suite, specifically) s =

[jquery-dev] Two diffrent jquery not works together

2009-10-30 Thread yashmistrey
Hello to All I have used different JavaScript on my website but only one script is working. This is the link http://makemycreative.in/30oct_09 You will see these a button Name: Services = That is working But under “service button” there is another Javascript “Slidshow” Could you please look in

[jquery-dev] Re: Should jQuery normalize this IE6 bug involving input/ names?

2009-10-30 Thread Dave Methvin
The alerts in following code do not show the same result in IE6 due to a bug[1] (also discussed on stackoverflow.com[2]). That's a well-known bug for those of us who lived through the dark time when IE6 was the most popular browser in the world (for some definition of popular). Should jQuery

[jquery-dev] Re: ajax options parameter

2009-10-30 Thread Dave Methvin
The ajax options parameter, unlike every other(?) options parameter, is used in place. That does seem kind of fishy. I don't recall seeing a ticket for this, it's at least worth considering. Do you want to create one at dev.jquery.com? -- You received this message because you are subscribed