9. Libraries are a crutch
Learn JavaScript first
Know enough to dislike parts
Supplement those parts
Don’t be afraid of the word `prototype`
If you don’t know $.fn === $.prototype, quit (or learn)
17. To be fair ...
// easy to write bad code in any library:
var $ = dojo.query;
$(“div button#bar”).onclick(function(){
$(‘#bam’).addClass(“bar”);
$(‘#bam’).css(“width”, “200px”)
$(‘#bam’).animate({ width: 300 })
}).trigger(‘click’);
23. CommonJS
Modules should be in the language, not here.
Forgot about the browser (see: Modules)
Though has nothing to do with the DOM
A bit late?
Only more time will tell.
25. MDC: Array.prototype
Array.forEach / map / filter / indexOf / etc etc
None of us handle sparse arrays to spec
jQuery.map vs jQuery().map offends my senses
dojo.map(ar, “return item * 2”) is too much magic
27. MDC: Fn.proto.bind
“this” is important.
var obj = {
counter:0,
inc: function(howmuch){ this.counter += howmuch || 0; }
};
var pfn = obj.inc.bind(obj, 5); // native, moo, proto way
var dfn = dojo.hitch(obj, “inc”, 5), // dojo
var dfn2 = dojo.hitch(obj, obj.inc, 5); // dojo is backwards
var jfn = jQuery.proxy(obj, “inc”); // so is jq. only w/ strings (also can’t pass args)
var jfn2 = jQuery.proxy(obj.inc, obj); // this is just plain inconsistent (no args here either)
29. Your library sucks, still.
I’m a grumpy old man. </rant>
No compelling reason for YOU not to use them
If you understand what it’s doing
If you don’t MIX
Non-trivial tasks
Portability
31. I WANT TO CHANGE TOPICS
Really. Let’s move forward, instead.
32. Propose: CommonBrowserJS
Reduce what we’ve learned over the years
Common Library to build upon
No Magic, Pure Standards
No UA sniffs, pure `feature detection`
Can load CommonJS modules/packages
Try to be agnostic? Back to Dojo beginnings.
33. Small Problems are Easy
MDC / ECMA standards are easy. What next?
Modularity
Stability (regressions, deprecation, sane versioning)
Localization/Internationalization? (l10n, i18n)
34. First pass: has.js
Agnostic Core
pure Feature Detection framework
API not as important as converging on test implementations
Naming shit is hard.