Subj : Re: spidermonkey ecma extensions To : netscape.public.mozilla.jseng From : Martin Honnen Date : Mon Sep 12 2005 05:43 pm steveH wrote: > The > other is the following code > > Tokenizer.prototype = { > get input() { > return this.source.substring(this.cursor); > }, > > is this use of get documented anywhere, I can see what it's doing - > defining a property getter, but I don't recall ever seeing it done like > this before ... The core JavaScript 1.5 guide has this section on getters and setters which also uses the above syntax. It is not entirely clear to me whether the above syntax is deprecated or not in regardance to Mozilla JavaScript but on the web you can't use it as other engines like the JScript engine in current IE versions or the engine in Opera will give you a syntax error. So on the web you need e.g. if (typeof Tokenizer.prototype.__defineGetter__ != 'undefined') { Tokenizer.prototype.__definerGetter__( 'input', function () { return this.source.substring(this.cursor); } ); } -- Martin Honnen http://JavaScript.FAQTs.com/ .