Here are some of the more weird things I've found over the years when using JavaScript. My most favorite quirk ever is:
typeof NaN // => number
Recently, I stumbled upon the "magic increasing number":
9999999999999999 // => 10000000000000000
And this is from my article on number parsing:
parseInt("01") // --> 1 parseInt("02") // --> 2 parseInt("07") // --> 7 parseInt("08") // --> 0 parseInt("09") // --> [...]
Asynchronous JavaScript
My team's been bogged down lately by some ASPX pages with very complex javascript behavior. Somewhere between Stratefied.js and Reactive Extensions for JS , there might be a way to tame them.
Stratefied.js introduces new language constructs to javascript to implement concurrency semantics. I'm not 100% on the semantics themselves — they bear looking further into, but they don't seem terribly complicated. The part I thought …
…your web applications and build your own, domain-specific protocols on top of them. AND IT'S ALL JAVASCRIPT.
I hope you are excited by now.
NOTE: The server side of WebSockets world is a whole different post. While the protocol itself is ridiculously simple, there are some performance considerations to have in mind. Luckily smarter people than us have already done most of the work. There are tons of solutions for Java, Python and even server-side Javascript , but if you're …
Asynchronous JavaScript
My team's been bogged down lately by some ASPX pages with very complex javascript behavior. Somewhere between Stratefied.js and Reactive Extensions for JS , there might be a way to tame them.
Stratefied.js introduces new language constructs to javascript to implement concurrency semantics. I'm not 100% on the semantics themselves — they bear looking further into, but they don't seem terribly complicated. The part I thought …
…when more browsers adopt them, you'll be able to make some really attractive user interfaces without a gif or Javascript effect in sight .
Have you experimented with CSS3 animations yet?
Further reading
CSS3 animation properties on W3
Mr Max Voltar on CSS Animations
CSS Animation on Surfin' Safari
this ._arrow = jQuery ( document. createElement ( ' img' ) )
. attr ( { border: 0 , src: this . settings . arrowImage } )
. addClass ( 'color_picker_arrow' )
. css ( { margin: 0 , padding: 0 , position: 'absolute' , top: 0 , left: 0 , zIndex: 10000 } )
. appendTo ( document. body ) ;
Grok the jQuery event model. jQuery has excellent support for working with events, but it is different from Prototype's. In particular, Prototype…
…example.com" when prompted for a URL. This is to avoid XSS problems with javascript: URIs and the like, and to keep browsers from resolving short URLs to be internal—nothing quite like being sent to http://yoursite.com/www.theirsite.com .
(Aside: there are better ways to handle this specific situation: a :before_validation callback to fix invalid URLs and check for XSS attacks, or the fantastic white_list plugin . But for now I'm interested in the general …
We'd like to invite you to RubyConf Uruguay , which will take place this October on Friday 29th and Saturday 30th, in Montevideo. This will be a single-track conference aimed at developers who want to learn or get up-to-date with Ruby, Ruby on Rails, Sinatra, Testing, SCRUM, JavaScript, SQL vs NoSQL, etc.
If you're interested in speaking at this event, we'll be happy to accept your proposals
RubyConf Uruguay organizers
Unobtrusive JavaScript
Unobtrusive JavaScript is one of the biggest changes on the frontend side of the upcoming Rails 3 version.
Rails 3 is no longer Prototype-oriented, Rails 3 code is now JavaScript framework agnostic and there are many incompatible changes that require your attention. Learn more about Unobtrusive JavaScript in Rails 3 .
Start converting your JavaScript right now and avoid using deprecated helper so that you won't have to change …
…stash of documents in your database, and you decide you need a new view on your data. Throw in the JavaScript functions and go ahead and query the view. Calling it a slow-down may be a stretch at times though, it really depends on how often your data is updated.
CouchDB will notice that the B-tree for the view doesn't exist yet, so it goes ahead and builds it on the first read. Depending on how many documents you have in your database, that can take a while, putting a good work load …