Elsewhere on the 'Net - Core

Core elsewhere on the 'Net.
Part of JavaScript.

18 June 2009

JavaScript tests & Compatibility tables

Robert Nyman created a proper test suite + compatibility table for JavaScript 1.6-1.8 features. Useful!

Core | Permalink

22 May 2009

ECMAScript 5 Strict Mode, JSON, and More

John discusses some new ECMAScript 5 features: strict mode and native JSON parsing. (It should be noted that IE8 is said to contain the latter already, though I haven't tested it yet so I can't say whether it adheres to the proposed implementation completely.)

Core | Permalink

13 April 2009

EcmaScript Edition 5, formerly known as 3.1: Getting a new JavaScript

Ajaxian gives a useful overview of where we stand with regard to ECMAScript 5.

Core, Standards/W3C | Permalink

3 April 2009

Overloading operators in JavaScript

Peter Nederlof points out an interesting trick: you can overload the + operator all by yourself by messing with toString(). Peter uses the trick to add vectors using just a +.

Interesting trick.

Core | Permalink

9 October 2008

Understanding eval scope

Rakesh Pai researches eval() and reports some truly curious findings; for instance a difference between plain eval() and window.eval() when they're used in an object method.

Required reading for anyone interested in JavaScript Core.

Core | Permalink

20 March 2008

A collection is not an array

James Edwards is quite right to point this out once again. Collections, such as those returned by getElementsByTagName(), are not arrays. In many cases it makes sense to convert them to an array, but you lose the dynamic nature of a collection. Even that's not terrible, but you should be aware of all these facts.

Core | Permalink

13 February 2008

Constructors considered mildly confusing

More data on constructors and prototypes. For me it's hard to follow since I don't know Java so I can't judge how much (or little) JavaScript resembles Java.

Core | Permalink

4 December 2007

Further links on ECMAScript 4

Liorean gives a very useful overview of who said what in the increasingly impossible-to-follow ECMAScript 4 debate.

Core, Linkdumps | Permalink

15 November 2007

Putting Java in our Script, our unfortunate doom

Dustin is not happy with the proposed JavaScript 2.0, largely because it makes JavaScript more like Java.

I know about the fight going on between (apparently) Mozilla/Adobe vs. Microsoft/Yahoo! about the spec, but I'm not sure what the actual issues are. Therefore I like this sort of opinion pieces: they show what people on both sides of the dividing line think.

Now let's hope for an opinion piece that defends the proposed changes in easy language.

Core | Permalink

2 November 2007

Bug Fixes in JavaScript 2

John calls attention to some changes in JavaScript Core that will gradually become supported. I especially like the this propagation.

Core | Permalink

19 July 2007

JavaScript Getters and Setters

John Resig explains getters and setters. I, for one, needed that explanation because I didn't have the faintest idea what they are. Now that I understand them I agree they're cool. Unfortunately they don't work in IE.

Core | Permalink

10 June 2007

ecmascript-lang.org

A new website dedicated to the evolving ECMAScript specification.

Core | Permalink

1 June 2007

JavaScript 1.8 Progress

John Resig on JavaScript Core updates in the upcoming Firefox.

Core | Permalink

17 May 2007

What’s new in JavaScript?

Dustin Diaz on prototypal inheritance. Although I don't pretend to understand all of it (I'm not really a programmer, and certainly don't have any kind of formal education in programming), I fully support his basic message that JavaScript is JavaScript, and should be approached as JavaScript, and not as, for instance, Java. If you want to write JavaScript, learn JavaScript.

Core | Permalink

11 May 2007

I Object

Douglas Crockford once more explains hidden properties in JavaScript objects. Every object not only has its own properties that you define for your own reasons, it also inherits quite a few methods and properties from other objects, ranging all the way back to the primordial Object object.

These inherited methods and properties will give false positives: for instance, every object you define has a constructor property. If your script doesn't make exclude these inherited objects explicitly, you have a problem.

Fortunately there is the hasOwnProperty() method that returns true if a property has been defined on the object itself; false if it's inherited from another object.

Core | Permalink

27 April 2007

I’d Rather switch Than Fight!

For once I disagree with Douglas Crockford: fall-throughs in switch statements are extremely useful. He doesn't actually deny that, but states that they can lead to complicated bugs; a statement that would have been stronger for some proof.

Take this simple function from Form Validation. It uses a fall-through because the types text, textarea and select-one should be treated the same:

function isRequired(formField) {
	switch (formField.type) {
		case 'text':
		case 'textarea':
		case 'select-one':
			if (formField.value)
				return true;
			return false;
		case 'radio':
			var radios = formField.form[formField.name];
			for (var i=0;i<radios.length;i++) {
				if (radios[i].checked) return true;
			}
			return false;
		case 'checkbox':
			return formField.checked;
	}	
}

My question is: what's wrong with this function? Which errors could occur? The only thing I can think of is the occurrence of an as-yet unknown type.

I'd love some clarification on why this is bad coding practice. I don't see the problem, but I don't want to doubt Douglas' word, either.

Core | Permalink

24 April 2007

Seven JavaScript Techniques You Should Be Using Today

Dustin Diaz shares a few important tricks. His addListener elegantly solves the problem of the missing this keyword in Microsoft's attachEvent, and his tip to include a method in getElementsBySomething is worthwhile, too.

Core | Permalink

3 April 2007

The only for loop you will ever need

Chris discusses and dissects ways and means of looping through an array. I still use the first, simplest way because I'm not convinced reading out the array's length every loop takes a lot of time, but it's useful to have such an overview.

Core | Permalink

12 January 2007

IE+JScript Performance Recommendations Part 3: JavaScript Code Inefficiencies

Some tips from the MSIE team.

Core | Permalink

28 September 2006

for in Intrigue

Douglas Crockford explains the finer points and dangers of the for in loop.

Core | Permalink

5 August 2006

JSON is a subset of the Object Literal

On the difference between an object literal and a JSON string. I wonder if this difference really exists in practice.

Core | Permalink

Can Your Programming Language Do This?

Joel Spolsky discovers JavaScript functions are really values. That opens a neat bag of tricks!

Core | Permalink

11 June 2006

JavaScript loop test

Which JavaScript loop is fastest?

Benchmarks, Core | Permalink

26 May 2006

JavaScript 2 and the Future of the Web

Brendan Eich's presentation on JavaScript 2.0, which I had the good fortune of attending in Amsterdam.

Core | Permalink

13 April 2006

Awkard Looking JavaScript

Dustin Diaz explores some curious-looking Core constructs.

Core | Permalink

12 April 2006

with Statement Considered Harmful

Agreed. Nobody uses it anyway, but it's useful to have one entry with all arguments against it.

Core | Permalink

15 March 2006

JS Generics

Erik Arvidsson's little library that ports the Mozilla Array and String extensions to other browsers. Useful.

Core | Permalink

22 February 2006

OOJS - overhyped and overcomplicating

Amen brother.

Core | Permalink

31 January 2006

Is this a Safari bug?

A Core bug in Safari.

Core, Safari | Permalink

27 January 2006

Dynamic scope

About some of the more curious aspects of JavaScript nested functions.

Core | Permalink

23 January 2006

Escaping regular expression characters in JavaScript

Always useful.

Core | Permalink

18 January 2006

Javascript Inheritance

On Java-style inheritance in JavaScript. Although personally I don't really see the point of adding inheritance to JavaScript, this article gives a nice overview and has a few interesting comments.

Core | Permalink

10 January 2006

Cheeky Tip: Default Function Arguments In JavaScript

A useful little trick, but be sure to read Stuart's caveat in comment 3.

Core | Permalink

11 November 2005

JS2 Design Notes

Brendan Eich reveals a few more interesting design principles for JavaScript 2.0 . As long as it's backward compatible I don't mind, though I don't see an immediate practical value for everyday scripting, either.

Core | Permalink

26 July 2005

JavaScript Module Conventions?

David Flanagan worries about possible conflicting namespaces when pages load a large number of scripts. He tries to create a list of requirements for a JavaScript module system, and asks for feedback. I myself have nothing to offer, since I know too little about namespaces, but maybe some of my readers will be able to help.

Core | Permalink

20 July 2005

TrimBreakpoint

An interesting function that allows you to set breakpoints in your JavaScript code. When a breakpoint is encountered, you can read out the values of your variables, which can be quite handy when you encounter a bug you can't solve with pure alerts. The script is one of the few practical examples of the use of closures.

Core | Permalink

14 July 2005

JS: The Good, the Bad and the Ugly

Erik Arvidsson proposes a few additions to JavaScript 1.6 . I largely have no opinion on these subjects, because I know too little about Core functionality, and avoid dates whenever I can. I'll leave it to wiser minds than myself to decide on these matters.

Core | Permalink

12 July 2005

And and Or in JS

Simple and to the point. I never thought of the target || srcElement trick. Worth remembering.

Core | Permalink

6 July 2005

Efficient JavaScript code

Tarquin gives some useful tips about writing efficient scripts. His discussion of for-loops and the errors people make when writing them are especially interesting.

Core | Permalink

This is the linklog of Peter-Paul Koch, mobile platform strategist, consultant, and trainer. You can also visit his QuirksBlog, or you can follow him on Twitter.

Atom RSS

Category rchives:

Monthlies: