background preloader

ECMAScript 5 compatibility table

ECMAScript 5 compatibility table

HTML5 Full-Screen Demonstration Oh look – a squirrel. Click to view full-screen… This demonstration illustrates how to use the HTML5 full-screen API which has been implemented in Firefox, Chrome and Safari. For further information, please refer to the article How to Use the HTML5 Full-Screen API… This example code was developed by Craig Buckler of OptimalWorks.net for SitePoint.com. Please view the source and use this code as you wish. Language – test262

CustomEvent 3. DOM Event Architecture 3.1 Event dispatch and DOM event flow This section defines the event dispatch mechanism of the event model defined in this specification. Event objects are dispatched to an event target. The propagation path MUST be an ordered list of current event targets through which the event object MUST pass. In the DOM event flow, event listeners might change the position of the event target in the document while the event object is being dispatched. Exceptions thrown inside event listeners MUST NOT stop the propagation of the event or affect the propagation path. In the following code, the exception thrown from the call to throw "Error" does not propagate into the parent scope (which would prevent the console.log statement from executing): As the next step, the event object MUST complete one or more event phases. The capture phase: The event object MUST propagate through the target's ancestors from the defaultView to the target's parent. Note 3.4 Trusted events

TypeScript for ActionScript Developers Introduction The following covers what the TypeScript language is compared to ActionScript 1, 2, and 3 with as much context as possible and compares the syntax side by side. This article should help serve as a reference while you learn TypeScript. Also, these articles always help me learn while writing them and I like to have documentation I can refer to later. You cannot really talk about ActionScript without talking about the Flash Player internals just like you can’t really talk about JavaScript for web development without also talking about browser internals. Thus, I’ve tried my best to make what the ActionScript equivalents are in the JavaScript browser world. What is TypeScript? TypeScript is awesome. Again, there are some other cool features such as overloading, interfaces, statics, follows ECMAScript 6, allows you to “use” ECMAScript 6 now, open source, blah blah blah, etc. Here its creator, Anders Hejlsberg of Turbo Pascal, Delphi, and C# fame, does a 1 hour overview. Yep. How? vs.

requestAnimationFrame for smart animating If you’ve never written code to animate inside the browser, you can stop reading :) What is requestAnimationFrame? In your animation work, you’ve used a timer loop to make changes every few milliseconds. Good for us: browser vendors have decided, “hey, why don’t we just give you an API for that, because we can probably optimize some things for you.” Why should I use it? The browser can optimize concurrent animations together into a single reflow and repaint cycle, leading to higher fidelity animation. OMG I can brag about having a site with battery-friendly animations? Yeah bro. How should I use this? Note: I am using ‘requestAnimFrame` here because since the spec is still in flux, I don’t want to make a straight polyfill, yet. 2012.01.07: The spec has gotten some fixes and settled down. A robust polyfill Opera engineer Erik Möller wrote about rAF and developed a polyfill that better handles browsers without native support. I have this polyfill available as a gist as well. Is it ready?

JavaScript JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. JavaScript's dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via eval), object introspection (via for...in and Object utilities), and source-code recovery (JavaScript functions store their source text and can be retrieved through toString()). This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments. Looking to become a front-end web developer? Get started

EventTarget - MDN Docs « DOM Reference Summary EventTarget is a DOM interface implemented by objects that can receive DOM events and have listeners for them. Element, document, and window are the most common event targets, but other objects can be event targets too, for example XMLHttpRequest, AudioNode, AudioContext and others. Many event targets (including elements, documents, and windows) also support setting event handlers via on... properties and attributes. Methods EventTarget.addEventListener() Register an event handler of a specific event type on the EventTarget. EventTarget.removeEventListener() Removes an event listener from the EventTarget. EventTarget.dispatchEvent() Dispatch an event to this EventTarget. Specifications Browser compatibility Additional methods for Mozilla chrome code Mozilla extensions for use by JS-implemented event targets to implement on* properties. void setEventHandler(DOMString type, EventHandler handler) EventHandler getEventHandler(DOMString type) See Also Document Tags and Contributors

Modules Node.js v0.10.22 Manual Stability: 5 - Locked Node has a simple module loading system. In Node, files and modules are in one-to-one correspondence. As an example, foo.js loads the module circle.js in the same directory. The contents of foo.js: var circle = require('. The contents of circle.js: var PI = Math.PI; exports.area = function (r) { return PI * r * r;}; exports.circumference = function (r) { return 2 * PI * r;}; The module circle.js has exported the functions area() and circumference(). Variables local to the module will be private, as though the module was wrapped in a function. If you want the root of your module's export to be a function (such as a constructor) or if you want to export a complete object in one assignment instead of building it one property at a time, assign it to module.exports instead of exports. Below, bar.js makes use of the square module, which exports a constructor: var square = require('. The square module is defined in square.js: Cycles# Consider this situation: a.js: b.js: main.js: . x.js:

Related: