Link

FT Labs introduces an auto-polyfill library: https://cdn.polyfill.io.

Short version: drop this in the <head> of your HTML:

<script src="//cdn.polyfill.io/v1/polyfill.min.js"></script>

and your browser has (basic/poyfillable) support for a lot of modern features. You can also specify which feature you want…

Link

Bjorn Tipling on javascript regexes. Some nice reminders, notably about state in regex objects and performance.

(Source: twitter.com)

Link

Nice in-depth explanation of JavaScript prototypes and inheritance, with a visualization of customizable code.

Also check out augment, “The world’s smallest and fastest classical JavaScript inheritance pattern” (via @roparz).

Tags: javascript oop
Link

Examples of how to do common event, element, ajax and utility operations with plain javascript.

Nice reference. Includes a selector with the earliest version of Internet Explorer you need to support.

Link

Progressive enhancement has never been about users who’ve turned JavaScript off, or least it wasn’t for me.
Christian Heilmann re-purposes a Mitch Hedberg observation to relate to progressive enhancement. Basically, when an elevator fails, it’s useless. When an escalator fails, it becomes stairs. We should be building escalators, not elevators.
Given the diversity of user agents, your JS failing isn’t an edge case. Sometimes it’ll be the browser’s fault, sometimes yours.

Link

Nicholas C. Zakas on the blind client-side-everything trend.

Text

Regex: Emulate Atomic Grouping (and Possessive Quantifiers) with LookAhead

Some regex flavors (like JavaScript’s) do not support Atomic Grouping (nor possessive quantifiers), but fully support LookAhead. It can be annoying when atomic grouping usually improves performance and helps preventing catastrophic backtracking that would cause exponential matching time.

Fortunately, you can emulate atomic grouping with LookAhead. (?>a) becomes (?=(a))\1. It works by matching (and capturing) the sub-expression in a LookAhead non character-consuming assertion, then matching it (effectively consuming the characters) with a backreference, not allowing backtracking at this point.

As possessive quantifiers like a++ have a strict equivalent using atomic grouping (here (?>a+)), we can also leverage this technique: a++ becomes (?=(a+))\1.

There are two downsides though: it complexifies the regex and it inserts a possibly unwanted capturing group for the sole purpose of matching. But still, it may still be a useful trick to know since the JS regex flavor is a bit sub-par.

On a side note, REL implements this behavior when converting a regex for the JavaScript flavor.

Link

Nobody seems to be happy, nobody seems to understand it … everyone is trying to change it, pretending to make it better … and again, nobody seems to realize it has been here since ever, it has been working in any field, it does everything, and it keeps getting faster!

On a related note, see All Right, Gentlemen!.

TypeScript

Link

Prism is a new lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.

(Source: lea.verou.me)

Video

Why, hello!. I’m Yeoman - a robust and opinionated client-side stack, comprised of tools and frameworks that can help developers quickly build beautiful web applications.

Looks promising:

  • Scaffolding (HTML5 Boilerplate, Twitter Bootstrap, AMD / RequireJS, tests…)
  • Build process with auto-compilation (CoffeScript, Compass), minification, optimization (HTML, images), generation of app cache manifest…
  • Package management yeoman install jquery FTW
  • Auto-Lint
  • PhantomJS unit testing
  • Built-in preview server

(Source: twitter.com)