github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1,852
    • 174
  • Source
  • Commits
  • Network (174)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (3)
    • master ✓
    • mobile
    • omgrequire
  • Switch Tags (41)
    • 1.4rc1
    • 1.4a2
    • 1.4a1
    • 1.4.2
    • 1.4.1
    • 1.4
    • 1.3rc1
    • 1.3b2
    • 1.3b1
    • 1.3.2
    • 1.3.1rc1
    • 1.3.1
    • 1.3
    • 1.2.6
    • 1.2.5
    • 1.2.4b
    • 1.2.4a
    • 1.2.4
    • 1.2.3b
    • 1.2.3a
    • 1.2.3
    • 1.2.2b2
    • 1.2.2b
    • 1.2.2
    • 1.2.1
    • 1.2
    • 1.1b
    • 1.1a
    • 1.1.4
    • 1.1.3a
    • 1.1.3.1
    • 1.1.3
    • 1.1.2
    • 1.1.1
    • 1.1
    • 1.0a
    • 1.0.4
    • 1.0.3
    • 1.0.2
    • 1.0.1
    • 1.0
  • Comments

Comments for jquery   feed

DBJDBJ commented on jquery/jquery Thu Mar 11 16:47:24 -0800 2010
Comment in ba8938d:

Fair enough.

function( text ) {
     return ! text ? "" : text.toString().trim() ;
 } :
// Otherwise use our own trimming functionality

-- DBJ

jeresig commented on jquery/jquery Thu Mar 11 16:31:53 -0800 2010
Comment in ba8938d:

I would really prefer to not throw an exception - we generally try to be forgiving of user input (trying to handle null/undefined gracefully, for example) and I'd like to continue that trend.

DBJDBJ commented on jquery/jquery Thu Mar 11 16:24:21 -0800 2010
Comment in ba8938d:

I can't believe how much time we have spent discussing string trim .... And ... I still can't stop ?
What strikes me above is that if String.prototype.trim is available then using the native trim boils down .. to erm, actually using it :

  function( text ) {
     return text.trim() ;
  } :
  // Otherwise use our own trimming functionality

Above will also behave properly, and in the case of text , not being a string, the above will/should throw TypeError.
--DBJ

DBJDBJ commented on jquery/jquery Thu Mar 11 06:43:03 -0800 2010
Comment in 141ad3c:

I hope it is not patronising if I offer this : http://gist.github.com/329172

Thanks : DBJ

DBJDBJ commented on jquery/jquery Wed Mar 10 09:47:14 -0800 2010
Comment in 141ad3c:

Results from http://jsbin.com/ehoje/12
Opera

    userAgent :Opera/9.80 (Windows NT 6.1; U; en) Presto/2.6.22 Version/10.50
   String.trim() → undefined
   String.protoype.trim() → function trim() { [native code] }

Safari

          userAgent :Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10
         String.trim() → undefined
         String.protoype.trim() → undefined

Chrome

        userAgent :Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.2 Safari/533.2
       String.trim() → undefined
       String.protoype.trim() → function trim() { [native code] }

FireFox

      userAgent :Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6
     String.trim() → function trim() { [native code] }
     String.protoype.trim() → function trim() { [native code] }

With IE I have not bothered ...

I really think we should not rely on String.trim() , being universaly avaialble

Thanks: DBJ

DBJDBJ commented on jquery/jquery Wed Mar 10 09:01:45 -0800 2010
Comment in 141ad3c:

Sorry I was to busy for a comprehensive comment.

" .... Also, there is no left/right trim in jQuery - only the one trim....

inside jQuery.extend we have this comment :

          // Trim whitespace, otherwise indexOf won't work as expected

And this declaration :

        rleadingWhitespace = /^\s+/,

Which now obviously should be removed and (tne new and correct)

         trimLeft 

Should be used, I think ?

Second. String.prototype.trim ---- v.s.--- String.trim

               15.5.4.20 String.prototype.trim ( )

The above is the only legal ES5 , trim() . There is no String.trim() in ES5. This is why I would rather not use it ....

Thanks: DBJ

jeresig commented on jquery/jquery Wed Mar 10 08:01:56 -0800 2010
Comment in 141ad3c:

@DBJDBJ: I'm not sure what you mean regarding String.prototype.trim - we don't use it, we're only using the native String.trim method, so it's best for us to check to see if that method exists. Also, there is no left/right trim in jQuery - only the one trim.

DBJDBJ commented on jquery/jquery Wed Mar 10 05:02:39 -0800 2010
Comment in 141ad3c:

Also , I seem to remember there is a trim left and/or trim right somewhere in jQuery which now can be changed to use trimLeft ot trimRight , regular expressions ?

Thanks: Dusan

DBJDBJ commented on jquery/jquery Wed Mar 10 04:58:07 -0800 2010
Comment in 141ad3c:

@john : thanks for commendation ;o)

one note ? to avoid all browsers ES5 transitional period pains, I would rather test for trim() existence like so :

 var native_trim = "function" === typeof "".trim ;

Some browsers support and implement String.prototype.trim, but not String.trim, I think ?

Thanks: DBJ

jeresig commented on jquery/jquery Fri Mar 05 07:00:35 -0800 2010
Comment in 2c08004:

@rkatic: Good point, just landed that change: 0a307b3

Leeoniya commented on jquery/jquery Fri Mar 05 06:51:02 -0800 2010
Comment in 145f2f0:

nvm, this fixes "etc"...was hard to see context

Leeoniya commented on jquery/jquery Fri Mar 05 06:33:54 -0800 2010
Comment in 145f2f0:

in the templating proposal you noted "This appears to be a bug in the appendTo, etc. implementation..."

etc?

rkatic commented on jquery/jquery Thu Mar 04 22:59:20 -0800 2010
Comment in 2c08004:

Then why no just:

jQuery( insert[i] )[ original ]( elems );
yfeldblum commented on jquery/jquery Tue Mar 02 13:01:03 -0800 2010
Comment in a4043cd:

Comments are verboten.

On a serious note, it's a popular idea that code should be clear - that if a piece of code needs comments to explain what it does, then that piece of code should be rewritten no longer to need comments.

Appropriate optimizations are exceptions to this rule, as are such things as high-level descriptions of algorithms and data structures, high-level descriptions of design and architecture, examples of how to invoke the code, key assumptions and contexts, etc.

cowboy commented on jquery/jquery Tue Mar 02 12:34:26 -0800 2010
Comment in a4043cd:

Why not use +new Date() and then include a comment. You know, one of those new-fangled thingamawhatsits often included in source code just like this that explains to the uneducated developer what that particular bit of magic does?

jdalton commented on jquery/jquery Tue Mar 02 11:45:15 -0800 2010
Comment in a4043cd:

*erm "use strict";, humor fail :D

jdalton commented on jquery/jquery Tue Mar 02 11:35:47 -0800 2010
Comment in a4043cd:

Hehe, I hear @kangax is getting a tramp stamp that reads "strict";

jeresig commented on jquery/jquery Tue Mar 02 11:01:44 -0800 2010
Comment in a4043cd:

@jdalton: To someone that reads specifications for fun, of course there's "Nothing magical about it." - but it's undeniable that it's much more obtuse than just doing a straight (new Date()).getTime(); or (new Date()).valueOf();.

jdalton commented on jquery/jquery Tue Mar 02 10:53:06 -0800 2010
Comment in a4043cd:

Nothing magical about it. ECMA 5th Ed. Page 169, Section 15.9.3.1 [[PrimitiveValue]] makes it pretty clear. (new Date).valueOf(); would also do :P

jamespadolsey commented on jquery/jquery Tue Mar 02 10:31:48 -0800 2010
Comment in a4043cd:

Fair point. I'm surprised closure compiler doesn't switch new Date().getTime() for +new Date...

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server