Re: [jQuery] util plugins, was: What tools ...

2007-01-24 Thread Stephen Howard
Consider posting your plugins to JSAN (www.openjsan.org).

Paul McLanahan wrote:
> It would be nice to be able to contribute to a folder like that.  I
> have several little plugins that I use as helpers on larger projects
> that I'm sure others would find useful as well.  Is there a way to
> easily allow people to only commit SVN to a single folder like "util",
> or would it be better just to submit code to you Jörn and let you
> decide what makes it into the util folder? I agree in any case that it
> would be nice to have a folder in the plugins SVN to check if you need
> something before coding it yourself to avoid reinventing the wheel.
> For example... I have a utility plugin that I wrote a while back that
> does exactly what your searchField plugin does.
>
> On 1/24/07, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
>   
>> Klaus Hartl schrieb:
>> 
>>> I wonder if we should add a folder like "Micro plugins" to SVN where
>>> these little helpers could go into... Brandon posted some as well recently.
>>>
>>>   
>> Like... http://jquery.com/dev/svn/trunk/plugins/util/searchField.js?rev=1177
>>
>> --
>> Jörn Zaefferer
>>
>> http://bassistance.de
>>
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
>> 
>
>
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Designing for reuse

2006-11-30 Thread Stephen Howard
I know we're all fond of the elegance of chaining, but would it be the 
least confusing to write it like:

var gridControl = new Grid( '#grid' )

where:

function Grid( dom_string ) {

jQuery( dom_string ).each( function() { instantiate here... } );
...
}

Remember not everything needs to look like jQuery.

- Stephen

Dave Methvin wrote:
> This will be a short thread--NOT! :-)
>
>   
>> Controller set of methods is returned..
>>
>> $('#grid').grid().data(data).drig().show()
>> $('#grid').grid().scrollToRow(6).drig().css("border", "1px")
>> 
>
> Uh, drig()? So if I want to return to I was before scrollToRow(6), should I
> use (6)woRoTllorsc?  ;-)
>
> I don't know if this a good idiom; changing the object type within the chain
> might be be too tricky. Also, would the plugin itself have a need for
> chained methods to change its internal state? Still, to make your object
> chainable like that, I think your $().grid method would just need to save
> its jQuery "this" in your Grid object before returning:
>
> jQuery.fn.grid = function() {
>   var gridObject = // ... get your grid object ...
>   gridObject.jQuery = this;
>   return gridObject;
> }
> jQuery.fn.drig = function() {
>   return this.jQuery;
> }
>
> As Jörn mentioned, you could still use $("#grid").grid() to create and/or
> retrieve a Grid object, even if it wasn't chainable. It seems like you'd
> want some way to determine whether it was a Grid creation or just getting an
> existing object; you could have a separate $().createGrid() method or maybe
> the $().grid() argument could be required on creation. (Also, should the
> core should a standard way for plugins to associate object data with an
> element, like it does with events?) 
>
> Whatever results from this discussion should go to the plugins authoring
> page on the wiki, http://jquery.com/plugins/Authoring/
>
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Next generation WYSIWYG editor... maybe? am I missing something?

2006-11-15 Thread Stephen Howard
I'm all for entheusiasm, but have you looked at tinyMCE?  What 
shortcomings does it have that you are trying to address?

http://tinymce.moxiecode.com/

- Stephen

Tom Holder wrote:
> Hi everyone,
>
> I've been getting increasingly frustrated by the flexibility and 
> output from all of the WYSIWYG editors available for the web so I want 
> to try and build an editor experience for our 2nd generation of CMS 
> that will achieve the following:
>
> * Integrate in to our sites without requiring CSS tweaks to get it
>   looking correct - this means no iframes.
> * Produce strict XHTML every time without fail.
> * Be simple to use.
> * Be quick to load and run.
> * Limit scope for the user to mess up their site design.
>
> I want to try and use JQuery to achieve all of the above (and 
> hopefully a bit more). To see the foundation of my editor have a look at:
>
> http://www.simpleweb-online.co.uk/stage/editor/test.htm
>
> Ok, it's very simple indeed, and doesn't actually let you edit 
> anything!! However, the idea is that you can designate a div as the 
> 'editor' and then within this you can drop elements (I would imagine 
> having a drop zone at the bottom?) for example:
>
> * p tag
> * h1-h4 etc
> * ul
> * image
> * definition list
> * various other stuff (e.g. a google map)
>
> Each of these elements would have an associated content editor for it. 
> For example an h1 would just have a 1 line text box, a p a text area, 
> an image a number of controls for src, alt, size etc.
>
> It's my thought at the moment that I will use ajax to save back 
> updates and re-ordering so that there is essentially no 'save' process.
>
> Does anyone have any thoughts on this? Perhaps I'm barking up totally 
> the wrong tree.
>
> Tom
> 
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery API discussion

2006-10-17 Thread Stephen Howard
I'd like to throw in my support for coalescing all the httprequest stuff 
into a request(method,{args}) method.  This is much closer to how I 
currently do my xhr stuff outside of jquery

Mark Gibson wrote:
> Why not just .request(method, options) or .http()
>
> After all AJAX is just a bottle of toilet cleaner ;), and a bit
> of a misnomer as a lot of calls don't even involve the X(ML).
>
> - Mark.
>
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Breakable Each

2006-10-12 Thread Stephen Howard
Yes, please.

-Stephen

John Resig wrote:
> I really prefer doing a 'return false' instead of throwing exceptions.
> It just feels like an incredibly messy way to handle things - plus it
> prevents you from writing good one-liners, which makes me sad.
>
> Plus the change is trivial, too:
>
> each: function( obj, fn, args ) {
> if ( obj.length == undefined )
> for ( var i in obj )
> if ( fn.apply( obj[i], args || [i,
> obj[i]] ) === false ) return obj;
> else
> for ( var i = 0; i < obj.length; i++ )
> if ( fn.apply( obj[i], args || [i,
> obj[i]] ) === false ) return obj;
> return obj;
> },
>
> Should I add it in?
>
> --John
>
> On 10/12/06, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:
>   
>> It seems like it would be really easy to implement a breaking mechanism
>> for jQuery .each() function. We could use the same technique prototype
>> does by creating a unique object and letting users throw that to break.
>> We could create a 'break' property inside jQuery that .each() could
>> catch to break the loop.
>>
>> Exception based (ala prototype) implementation:
>>
>> Example:
>> $("p").each(function() {
>> if ($(this).is(".unnecessary.beyond.here")) throw $['break'];
>>
>> $(this).addClass('this').addClass('was').addClass('totally').addClass('required');
>> };
>>
>> Code:
>> jQuery['break'] = new Object();
>> jQuery.extend({
>> each: function( obj, fn, args ) {
>> if ( obj.length == undefined )
>> for ( var i in obj )
>> try {
>> fn.apply( obj[i], args || [i, obj[i]] );
>> } catch (e) {
>> if (e == jQuery['break']) break;
>> throw e;
>> }
>> else
>> for ( var i = 0; i < obj.length; i++ )
>> try {
>> fn.apply( obj[i], args || [i, obj[i]] );
>> } catch(e) {
>> if (e == jQuery['break']) break;
>> throw e;
>> }
>> return obj;
>> },
>> });
>>
>> Return Value based implementation:
>>
>> Example:
>> $("p").each(function() {
>> if ($(this).is(".unnecessary.beyond.here")) return $['break'];
>>
>> $(this).addClass('this').addClass('was').addClass('totally').addClass('required');
>> };
>>
>> Code:
>> jQuery['break'] = new Object();
>> jQuery.extend({
>> each: function( obj, fn, args ) {
>> if ( obj.length == undefined )
>> for ( var i in obj )
>> if ( fn.apply( obj[i], args || [i, obj[i]] ) ==
>> jQuery['break']) break;
>> else
>> for ( var i = 0; i < obj.length; i++ )
>> if ( fn.apply( obj[i], args || [i, obj[i]] ) ==
>> jQuery['break']) break;
>> return obj;
>> },
>> });
>>
>> The code for this feature is marginal and it is one of the few things
>> that I miss from my prototype days. This code is untested and might not
>> work the way I expect it to, but you get the drift.
>>
>> -blair
>>
>> NB It may be better to use something other than 'break' as the variable
>> name as it's a reserved word and you'd have to use the square bracket
>> notation any time it is used.
>> 
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Selected value in dropdownlist

2006-10-05 Thread Stephen Howard
if ddlCourse is the select box, you can simplify your code to this, but 
I'm not sure why it isn't working:

$(function() {

$('#ddlCourse").change( function() {

$('#class').load( 'filter_report.asp',  {  ajax: 1,  cod_course: 
this.value  } );
});
});

Have you tried doing an alert(this.value) to see if it's a problem with 
the select box value retrieval or a problem with the ajax loader?

-Stephen

Harlley Roberto wrote:
> Hi folks,
>
> How can I get selected value in dropdownlist?
>
> That code does not work. Why ?
>
> $(document).ready(function()
> {
> var test;
> test = document.getElementById("ddlCourse").value;
> $("#ddlCourse").change( function() { 
> $('#class').load('filter_report.asp', {ajax:'1', cod_course: test }); } );
> });
>
>
> thanks,
>
> Harlley
> [EMAIL PROTECTED] 
> 
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] String Parsing

2006-10-03 Thread Stephen Howard
try using a regex and matching ([^\]+$)

I'm not up on my \ escaping for javascript, so you may need a different 
number of \'s in there to make it work

Tombo wrote:
> this might not be jquery related, but i noticed there are a lot of savvy
> javascript programmers in this mailing list.
>
> i want to grab just the filename and extension from the following string:
>
> str1="F:\\Test1\\Test2\\Test3\\test.txt";
>
> i want to grab "test.txt"
>
> i use this code:
>
> file1=(str1.split("\\"))[(str1.split("\\")).length-1];
>
>
> i was wondering if there is a better way to grab that part of the string
>
> Thx for any help
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Accessibility. Take it Seriously in Your Web Apps.

2006-09-11 Thread Stephen Howard
Consider your own independence.  Now consider needing to rely on others 
for many tasks in your life.  Why would someone with disabilities be any 
less desirous of independence than yourself?  Sure, it's a bit of a 
hassle from a developer's point of view when you have so much else 
already stacked on your plate.  Maybe screen reader companies who want 
an edge on the market should work harder at working with the mess of a 
web that is already out there.  And maybe we can all chip in a bit to 
make the web a more useful place for everyone.  Frankly, solid semantic 
web design is a goal for me regardless of the accessibility issue.  
Where it gets tricky of course is graceful degredation of all the 
javascript work we're so fond of on this list.  But I've heard enough 
other people also express that as a goal that I would expect we'd be 
batting pretty well there too.

-Stephen

Andy Matthews wrote:
> I can understand laws on physical access. My uncle is a parapalegic, and had
> to fight to gain access to public buildings in Jacksonville, Flordai (where
> he lives). But to carry the law over to the website is just pushing it. It's
> "less expensive" than building ramps to all of your stores, but why?!? At
> what point do we stop bowing to political correctness and start telling
> people "you're BLIND...get a friend to help you with the website."
>
>  andy matthews
> web developer
> certified advanced coldfusion programmer
> ICGLink, Inc.
> [EMAIL PROTECTED]
> 615.370.1530 x737
> --//->
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Morbus Iff
> Sent: Monday, September 11, 2006 8:28 AM
> To: jQuery Discussion.
> Subject: Re: [jQuery] Accessibility. Take it Seriously in Your Web Apps.
>
>
>   
>> I completely and totally disagree with the court in this case. At what
>> 
> point
>   
>> does it stop? Does my personal blog need to be accessible to the blind?
>> 
> What
>   
>> if I don't care about them? Why should the courts get involved in this
>> 
>
> No, your personal blog doesn't need to be accessible because it does not
> have a commercial brick and mortar store. Much like government agencies
> have to follow accessibility in the real world (and are /required/ to do
> the same on the Web with US 508), commercial entities have the same
> basic requirements (wheelchair ramp). These laws extending to their
> commercial entities on the web is not a huge leap to make.
>
>   
>> I just think that we're taking things like this a little too far, IMO.
>>
>> > andy matthews
>> web developer
>> certified advanced coldfusion programmer
>> ICGLink, Inc.
>> [EMAIL PROTECTED]
>> 615.370.1530 x737
>> --//->
>> 
>
> It's " Morbus Iff ( take your rosaries off my ovaries )
> Technical: http://www.oreillynet.com/pub/au/779
> Culture: http://www.disobey.com/ and http://www.gamegrene.com/
> icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] checkbox items with same name

2006-09-06 Thread Stephen Howard
I think that this might work, though I haven't tried combining attribute 
tests and pseudo classes before:

$('[EMAIL PROTECTED]:checked')

Shawn's solution below won't work for you because it is searching on ids 
rather than names, which is what you have.

Shawn Tumey wrote:
> On 9/6/06, *Aljosa Mohorovic* <[EMAIL PROTECTED] 
> > wrote:
>
> i have 5 checkbox items with same name:
>
> 
> 
> 
> 
> 
>
> and option to select multiple elements with same name must work.
>
> $('#form_name').find("[EMAIL PROTECTED]@checked]") gives me only
> one element.
> how can i use checkbox elements like select tag?
>
> Aljosa Mohorovic
>
>
> Get all element with the geographic id by doing:
>
> $('#geographic')
>
> Then you can reference the DOM object as an array like:
>
> alert($('#geographic')[4].value));
>
> This should alert 5 which is the value of the fifth element in base 0 
> indexed array.
>
> If you want to do something on all of the checkboxes with jQuery use:
>
> $('#geographic').each(function {
> 
>})
>
> Hope this helps. :)
>
> -- 
> Shawn Tumey
> Cofounder
> MT Web Productions LLC
> 
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] On-Demand Javascript?

2006-09-05 Thread Stephen Howard
Well, that is one conclusion you could reach.  The other is that perhaps 
jQuery needs a couple of components extracted and turned into external 
libraries that it then depends on (ajax, etc).  A bit blasphemous, I 
know, considering jQuery is supposed to be easy to download as a 
standalone, but there's no reason the libraries + jQuery couldn't be 
stitched together into a 'standalone' package for download on the jQ 
server.  This would also open up the well-vetted sub-systems of the jQ 
universe to other developers without requiring all of jQuery.  For 
example, Christof's scriptloader could use jQ's ajax code, or could 
merge with it.  The mandate of the ajax library would certainly include 
the sorts of things that he and JSAN have in mind.

-Stephen

Jörn Zaefferer wrote:
> Stephen Howard wrote:
>   
>> jQuery remains coherent and quantifiable, rather than an ever expanding 
>> kitchen sink, 
>> and we get peer libraries that the community knows will play well with 
>> the beloved jQ.  Remember the old Unix saw about doing one thing and 
>> doing it well (aside from Emacs, of course).  I think it ought to 
>> pertain here as well.
>>   
>> 
> You make a good point. Its similar to the idea of integrating a class 
> creating facility in jQuery that came up a few days ago. Should this be 
> seperated from jQuery as it has nothing to do with DOM manipulation? I'm 
> not so sure, because most aspects of the class creation facility are 
> already available in the jQuery code. This is also true for OnDemand-JS, 
> as all the AJAX stuff is already covered. I'd like to see jQuery 
> concentrate on its strength, but on the other hand, I don't like 
> duplicating code.
>
> jQuery itself claims to change the way you write javascript. With 
> helpers like $.each, $.map and $.trim it does just this, without 
> touching DOM, FX or AJAX at all.
>
> I therefore vote to integrate an On-Demand Javascript facility into jQuery.
>
> -- Jörn
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] On-Demand Javascript?

2006-09-05 Thread Stephen Howard
Well, as I've put it down below, this isn't really an issue of code 
purity (although I'm sure that bugs me too).  What I was trying to say 
was that it is an issue of readability.  At least to me, seeing $ in my 
javascript code indicates DOM manipulation.  So my preference is to make 
anything not pertaining to DOM manipulation not look like jQuery.  I 
certainly wouldn't have any issues if John or the jQ community wanted to 
write/sponsor/host solutions that didn't fall under the jQ mandate, but 
what harm is there in putting them into their own namespace?  I'd argue 
that it would only add clarity to the situation.  jQuery remains 
coherent and quantifiable, rather than an ever expanding kitchen sink, 
and we get peer libraries that the community knows will play well with 
the beloved jQ.  Remember the old Unix saw about doing one thing and 
doing it well (aside from Emacs, of course).  I think it ought to 
pertain here as well.

-Stephen


Dan Atkinson wrote:
> I'd be -for- having something like this inside jQuery.
>
> For all the other non-element additions that there in jQuery, something like
> this would be a great feature to have.
>
> As much as code purity is a good thing, there comes a point when you say
> 'well, this might just make things better...'.
>
>
> Stephen Howard wrote:
>   
>>
>> Christof Donat wrote:
>> 
>>> Cons:
>>> - either you need to do synchronous loading like JSON does or you need to
>>> work 
>>> with callbacks as I do. Synchronous loading blocks the browser, callbacks
>>> are 
>>> not understood by everyone.
>>>
>>>   
>>>   
>> I believe Christof is referring here to JSAN (openjsan.org) not JSON 
>> (data format) when he is referring to the synchronous loading
>>
>>
>> I'd like to throw in my voice in support of Christof's call for keeping 
>> things like this out of jQuery proper.  To me 'doing different things 
>> should look different'.  When i see raw ajax calls and such hanging off 
>> $ that looks wrong, as I think of $ signifying that I'm selecting and 
>> manipulating the DOM.  If I'm doing something that doesn't have to do 
>> with DOM selection, I shouldn't see the $ in my code, because that's 
>> what I associate it with, and anything else interrupts the visual 
>> texture of my code.
>>
>> -Stephen
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
>>
>> 
>
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] On-Demand Javascript?

2006-09-05 Thread Stephen Howard


Christof Donat wrote:
>
> Cons:
> - either you need to do synchronous loading like JSON does or you need to 
> work 
> with callbacks as I do. Synchronous loading blocks the browser, callbacks are 
> not understood by everyone.
>
>   
I believe Christof is referring here to JSAN (openjsan.org) not JSON 
(data format) when he is referring to the synchronous loading


I'd like to throw in my voice in support of Christof's call for keeping 
things like this out of jQuery proper.  To me 'doing different things 
should look different'.  When i see raw ajax calls and such hanging off 
$ that looks wrong, as I think of $ signifying that I'm selecting and 
manipulating the DOM.  If I'm doing something that doesn't have to do 
with DOM selection, I shouldn't see the $ in my code, because that's 
what I associate it with, and anything else interrupts the visual 
texture of my code.

-Stephen

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] filter() on attributes?

2006-09-05 Thread Stephen Howard
Try $('#foo [EMAIL PROTECTED]"bar"]').val()

Dossy Shiobara wrote:
> Then, get the value with something like:
>
> $("#foo input[name=bar]").val();
>
>
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Submit a form?

2006-09-02 Thread Stephen Howard



Myles Angell wrote:

$("#report-form").get(0).submit();

Return false isn't neccessary

On 9/1/06, *Lewis, David* < [EMAIL PROTECTED] 
> wrote:


Using jQuery, is there an easy way to find a form in an HTML
document, submit it, then return "false" (to avoid resubmission of
the form).

 


Using the HTML snippet:









 


… and the Javascript:

$('#report-submit').click(function() {

  $('#report-form').submit();

  return false; /* cancel the form submission */

});

 


… the form does not appear to be submitted. Thanks in advance for
any help!

 


~ David

 



___
jQuery mailing list
discuss@jquery.com 
http://jquery.com/discuss/





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
  
<>
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery and openjsan.org

2006-08-21 Thread Stephen Howard
I know you wanted to hear from non-Perl programmers, but I thought  I'd 
throw this in, as I've suggested on the jQuery list in the past that 
people submit their jQuery work to JSAN (I have a couple of pre-jQuery 
items on JSAN myself)

The killer I think for JSAN is the infrastructure's immaturity. At least 
for a time, Casey seemed to be running the uploads for JSAN manually, so 
you never knew when your code would hit the repository.

Another thing I think needs improving is a browseable interface to the 
repository.  I think this is one of cpan.org's strengths that is missing 
from openjsan.  In addition to the search box (search.cpan.org), CPAN 
has browseable categories for modules.  No such interface seems to exist 
for JSAN.

People from other language backgrounds may have different objections, 
but those are what seem to be standing in the way from my point of view.

-Stephen

John Beppu wrote:
> to John Resig:
>
> Have you considered uploading jQuery to openjsan.org?
>
> I ask, becuase I feel the Perl guys could use a decent foundation to
> do their work on, and jQuery might fit the bill.
>
> 
>
> to everyone else:
>
> I'm a little concerned about JSAN, because it started out as a
> promising project to bring something CPAN-like for all Javascript
> programmers, but it's kinda fizzled out after the initial excitement.
> One serious problem in my mind is that it's mainly Perl people who
> seem to care about it right now while people from other language
> communities (like Ruby, Python, PHP, Java, etc.) seem to ignore it.
> In the very beginning, this wasn't the case, because the guy who wrote
> Prototype was willing to work with the JSAN group, and the guy who
> wrote MochiKit (a python guy) actually has uploaded a few versions to
> openjsan.org (although it seems like he hasn't uploaded the latest
> versions).  There was an initial willingness by a diverse group to
> work together, but this doesn't seem to be the case anymore, and
> that's sad.
>
> My hunch is that aspects of openjsan.org take a bit too much from the
> Perl community, and for whatever reason, this is a turn-off to
> non-Perl programmers.  (I think using POD for Javascript documentation
> may be one of these things but it's hard for me to say)
>
>
>
> Anyway, I'd like to hear from non-Perl programmers what they think of
> openjsan.org and especially what they DO NOT like about openjsan.org
> (so we'll know what to fix).
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Using "." in id attributes confuses jQuery

2006-08-19 Thread Stephen Howard
I think i'm confusing things here.  In addition to using dashes in class 
names and ids, I use them for custom property (attribute) names as 
well.  specifically because I like to make my non-xhtml properties stand 
out, usually by prefixing them with the 'x-' prefix, similar to 
non-standard mime types and http headers. for example:



John Resig wrote:
>>> I actually use '-' myself, which doesn't conflict with CSS, but jQuery
>>> still doesn't like them because of the attr() function translates
>>> this-name into thisName.
>>>   
>> I always use '-' in my ids and classes. This is really bad. I think that
>> should be fixed!
>> 
>
> I'm really confused here - the .attr() function doesn't translate the
> property values, only the property names.
>
> So doing id='foo-bar', that works - you can do #foo-bar just fine.
> Does anyone have proof to the contrary?
>
> --John
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Using "." in id attributes confuses jQuery

2006-08-19 Thread Stephen Howard
I actually use '-' myself, which doesn't conflict with CSS, but jQuery 
still doesn't like them because of the attr() function translates 
this-name into thisName.

I think we're all just stuck with using [A-Za-z0-9_] for attribute and 
id names :)

-Stephen

John Resig wrote:
> Hehe - it seems like we have discussion about once a month - it goes
> something like this:
>
> You: "I use IDs with '.' and/or ':' in them - it's part of the (X)HTML spec!"
> Me: "Ooh, that'd be nice - but it''s actually not of the CSS Selector
> spec, which jQuery uses."
>
> When we get an FAQ up, I'll be sure to add it. No worries, though.
>
> Think about it in this sense - is it possible to use these as
> selectors - and what exactly do they mean?
>
> #foo.bar
> #foo.bar3
> #foo.3
>
> #foo:bar
> #foo:link
> #foo:visited
>
> Both ':' and '.' have special meaning in CSS and/or XPath, so it's
> really best to use another character if you wish to access/style them
> using jQuery/CSS.
>
> --John
>
> On 8/19/06, John Beppu <[EMAIL PROTECTED]> wrote:
>   
>> I was playing around with jQuery today, and I came across something 
>> unfortunate.
>>
>> I was in the habit of using the "." character in id attributes.  For
>> example, if I had a page full of notes, the mark-up might look like:
>>
>> 3rd note
>> 4th note
>>
>> What's unfortunate is that:
>>
>>   $('#note.3').size() == 0
>>   $('note.3').size()  == 0
>>
>> The lesson here might be that even though "." is a legal character[1]
>> to have in an id field, its existence in an id can conflict with CSS
>> selectors that interpret "." as a sigil to signify that a class name
>> follows.  This really sucked, because I used the "." character in id
>> attributes extensively (until now).
>>
>> I hope that I can switch over to using ":" as a separator character to
>> use in my id attributes.  I also hope that it doesn't conflict with
>> CSS selectors or XPath, but I'm not sure on either count.
>>
>> [1] http://www.w3.org/TR/xhtml1/#C_8
>>
>> ___
>> jQuery mailing list
>> discuss@jquery.com
>> http://jquery.com/discuss/
>>
>> 
>
>
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Is there a simple way to break out of.each(function(){....});

2006-08-18 Thread Stephen Howard
Yeah, I had suggested returning an explicit false from your each 
function should short circuit.  It was an easy add to the jquery source 
too, but I believe jq 1.0 is in feature freeze at the moment.

-Stephen

Dave Methvin wrote:
> There was some discussion of this on the list earlier (June?) but it 
> doesn't look like there is currently a way to break out early. You 
> could wrap the each  in a try/catch and then throw from your function. 
> I don't know if that meets your "simple" criterion though.
>  
> 
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>   

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/