On Sun, 19 Dec 2010 08:39:00 +0100, Juriy Zaytsev wrote:
__proto__ also appears to be marked as "deprecated" in current version of
corresponding MDN docs. I wouldn't be surprised to see it go soon (if
that doesn't break web too much).
I'm afraid I don't see it going away any time soon.
For
On Sun, 19 Dec 2010 22:19:25 +0100, Juriy Zaytsev wrote:
On Sun, Dec 19, 2010 at 7:21 AM, Lasse Reichstein <
reichsteinatw...@gmail.com> wrote:
Also, it provides a feature that ES5 doesn't yet: the ability to change
an object's prototype chain. ES5 brought us Object.get
On Mon, 20 Dec 2010 09:24:12 +0100, Dmitry A. Soshnikov
wrote:
On 20.12.2010 1:16, Lasse Reichstein wrote:
[Mutalbe __proto__]
It's there now, so performance won't be any worse than today.
Personally, I think the cost of a mutable prototype is subsumed in the
cost of havi
On Thu, 16 Dec 2010 16:49:51 +0100, Rick Waldron
wrote:
I'm sure you've already seen this, but for those that haven't...
Issue 633: Implement harmony proxies
http://code.google.com/p/v8/issues/detail?id=633
You can follow the progress
The existence of a feature request does not guarantee
On Sun, 26 Dec 2010 08:55:33 +0100, Juriy Zaytsev wrote:
It makes sense to differentiate between "mutable [[Prototype]]" and
__proto__ — as one of its implementations.
It also makes sense to differentiate between real mutable prototype and
initially configurable prototype.
The examples where
On Mon, 27 Dec 2010 13:13:31 +0100, Nick Morgan
wrote:
Hi guys
I've written a new blog post about something that's been bothering me
for a
while - the distinction between pass-by-reference and pass-by-value.
http://skilldrick.co.uk/2010/12/clearing-up-the-confusion-around-javascript-refe
On Wed, 29 Dec 2010 08:25:33 +0100, Emeka wrote:
Is Prototype JavaScript's way of solving Expression Problem? And what is
really the difference between __proto__ and Prototype?
That depends on what you mean by "Prototype".
The internal [[Prototype]] link of objects is a way to inherit (and
On Thu, 30 Dec 2010 14:48:44 +0100, Tom Wilson
wrote:
I just finished reading "High Performance JavaScript" and now I'm paying
more attention to scope. So my question is: within an object method, is
there any benefit to declaring a local variable referencing 'this'? Is
that just redundan
On Fri, 31 Dec 2010 14:46:37 +0100, Dmitry A. Soshnikov
wrote:
So, why does this code produces a SyntaxError:
function () {
...
}()
...
Try to provide as much complete explanation as possible. Also try to
answer without cheating ;)
Because an ExpressionStatement may not start with th
On Sun, 02 Jan 2011 18:27:43 +0100, porneL wrote:
I'm wondering if it's possible to execute code in a bookmarklet in a way
that prevents interference from a hostile web page. Specifically I'm
interested if a secret value can be hidden in bookmarklet that cannot be
intercepted by the page.
On Sun, 02 Jan 2011 23:33:08 +0100, porneL wrote:
On Sun, 02 Jan 2011 19:30:11 -, Lasse Reichstein
wrote:
Pretty certainly. Do you remember which browser and version had this
problem?
Firefox 2 and others. http://ejohn.org/blog/re-securing-json/
Thanks. Good thing that was fixed
On Sun, 02 Jan 2011 23:07:14 +0100, Garrett Smith
wrote:
On 1/2/11, Lasse Reichstein wrote:
It's redundant at best. At worst it can lead to a small slowdown.
The "this" operator is special and will always refer to the same value
during a call, and that value is (in ES3)
On Mon, 03 Jan 2011 16:14:55 +0100, Dmitry Soshnikov
wrote:
Yes, the thing I wanted to underline, that the parser (because of
"ExpressionStatement" cannot begin with a `function` keyword) always
treats such production as a `FunctionDeclaration`. And that the
`SyntaxError`
relates to two
On Mon, 03 Jan 2011 02:09:26 +0100, porneL wrote:
Here's my first attempt:
https://gist.github.com/762984
Can you hack it?
Partially.
You use "0 + href.charCodeAt(i)" to convert the value to a number, but it
doesn't work.
If the return value of charCodeAt is a string, it instead prepe
On 1/5/11, Lasse Reichstein wrote:
> Another problem is that you accept numeric values above 256 from
> charCodeAt, but assume that it's only 8 bits.
Generally, I think it would be safer to test the value to be one of
the ones you accept, with some if-statements, and bail out if it
On Fri, 07 Jan 2011 17:29:23 +0100, jdalton
wrote:
But I've heard Brenden Eich doesn't think __proto__ is a good idea
anymore.
__proto__ is great, has a long history of support (at least 13yrs),
and is now supported by every major browser (Safari, Chrome, Firefox,
Opera), except IE.
It
On Mon, 10 Jan 2011 18:48:29 +0100, Fran wrote:
Why does "void(any_input)" return "undefined" ?
As others have said, it's the way it's defined. "void" is an operator that
takes
one operand and evaluates to "undefined".
Notice that the parentheses are not needed. "void 2+4" works just as we
On Thu, 13 Jan 2011 18:33:53 +0100, Joel Dart wrote:
Why? Well, simply because that's how the specification says it should
be.
I'm taking a guess here, trying to justify this and would appreciate
feedback in my thinking. Since new has to set up the prototype chain,
it would necessarily
On Sat, 15 Jan 2011 04:15:52 +0100, Joel Dart wrote:
Number constructor has to exist to give access to the prototype which I
agree isn't as useful in itself. However, augmenting Array has several
interesting uses. The more I think about it, the more I see that the
constructors and access
On Sat, 15 Jan 2011 17:38:24 +0100, Michael Haufe (TNO)
wrote:
Here is a contrived example, but with some imagination I think some
utility could be applied to this.
var a = 6
var b = Number(6)
That's the same as "a".
var c = new Number(6)
Number.prototype.valueOf = function(){
throw
On Fri, 04 Feb 2011 20:10:05 +0100, jemptymethod
wrote:
I want to delete a couple of object properties, but first save those
properties, then add them back after I'm done processing the object
*without* those properties.
Seems reasonable.
But I can't do the following, when I log the objec
On Fri, Feb 4, 2011 at 4:51 PM, jemptymethod wrote:
> I'm setting ExtJS form values in one of their ubiquitous config
> objects based on JSON data from an Ajax call.
>
> For currency fields I am calling "toFixed(2)" on the numbers such as:
>
> jsonObj.shippingAndHandling.toFixed(2)
> jsonObj.tota
On Fri, Feb 4, 2011 at 7:13 PM, Michael Haufe (TNO) wrote:
>
> If you want a consistent way to evaluate and "enforce" the type of
> individual values through the instanceof operator, this would be the
> approach to use.
>
In that case, you'll rarely have a meaningful class that contains only a
On Mon, 07 Feb 2011 01:58:03 +0100, Jorge wrote:
On Feb 7, 12:35 am, jdalton wrote:
@Jorge:
Shows Chrome 11 and Safari 5 failing at least 1 of the tests:
http://jsbin.com/ipowa4
It's quite debatable whether it's a bug to create a table with a
tbody...
I concur.
The test checks whethe
On Mon, 07 Feb 2011 22:18:02 +0100, DaveC
wrote:
I think it worth a further nod wrt function statements inside of a
block statement.
ECMAScript allows syntactic extensions, one such extension is to allow
function statements inside of a block statement currently Mozilla is
the only vendor (*I
hat it evaluates the variable declaration in the global scope,
and returns the x declared in test instead.
I.e., to get "direct call to eval" functionality in Chrome and Safari, you
need to use an direct reference to the "eval" property of the global
object.
Nothing else
On Thu, 03 Mar 2011 20:08:33 +0100, Jarek Foksa
wrote:
When writing constructor functions it's very convenient to create "var
self = this" assignment so that we could easily access other
properties and methods even if default context has changed, for
example:
var Dialog = function() {
var
so few and rare that
it's
safe to say that if you use eval, you are doing something wrong.
/L
[1] Abbreviated like that probably because CSS was already taken (or
because
some people just love phonetic abbreviations).
[2] http://xkcd.com/327/
[3] Now you have two problems.
--
Lasse
le
have begun relying on the order of the existing browsers, so that any new
browser
must try to match that or break existing pages.
/L
--
Lasse Reichstein - reichsteinatw...@gmail.com
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/jsmento
e into brevity (which there isn't really a good reason for), you
can even do
return !(arg & 1);
/L
--
Lasse Reichstein Holst Nielsen - reichsteinatw...@gmail.com
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/jsmentors@jsmentors.co
timize closures
with no free variables.
In, e.g., V8, a local variable that isn't captured by a closure can be kept
on the stack. If it is captured, it's moved to a heap based record that the
closure has access to. I.e., whether a closure captures something can be on
a per-variable basis
e "a",
then it's possible to make a closure that can't access the "a" variable -
because
it's known at compile time that it never will.
/L
--
Lasse Reichstein Holst Nielsen - reichsteinatw...@gmail.com
--
To view archived discussions from the original JS
s that you
now have two problems. RegExps aren't exactly easily maintainable
- more like write-only code, even less readable than perl code.
/L
--
Lasse Reichstein Holst Nielsen - reichsteinatw...@gmail.com
--
To view archived discussions from the original JSMentors Mailman list:
http://www.m
ugh. No need
to confuse
people more than necessary :)
I really like the summary. It sums up the general concept very well.
/L ' http://fiddle.jshell.net/Gmwuw/ '
--
Lasse Reichstein Holst Nielsen - reichsteinatw...@gmail.com
--
To view archived discussions from the original JSMentors
On Tue, 26 Apr 2011 21:31:16 +0200, Poetro wrote:
2011/4/26 Lasse Reichstein :
In Javascript you can create functions with free variables that aren't
defined
anywhere (yet), because the scope chain is mutable.
In JavaScript there is thing called hoisting, so ever variable that is
de
ource code, and it hasn't changed recently. ;)
/L
--
Lasse Reichstein Holst Nielsen - reichsteinatw...@gmail.com
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/jsmentors@jsmentors.com/
To search via a non-Google archive, visit here:
http://
d snapshot versions of Chromium at
http://build.chromium.org/f/chromium/snapshots/
You just need to know which versions are stable :)
/L
--
Lasse Reichstein - reichsteinatw...@gmail.com
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com
On Tue, Jul 5, 2011 at 2:57 AM, Poetro wrote:
> 2011/7/5 David Marrs :
> > Why do you have a 2nd arg in your lambda called undefined?
> Because he might want to use the undefined value, and in case someone
> in the global scope created a variable named undefined, then it can
> cause trouble.
>
I
On Tue, Jul 19, 2011 at 3:44 AM, RobG wrote:
>
> Not really worth the effort. __proto__ is deprecated and shouldn't be
> used for anything:
> https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/proto
> >
I guess people will stop using it when there is a replacement that
On Wed, Aug 3, 2011 at 4:10 PM, Stefan Weiss wrote:
> On 2011-08-03 15:49, UI Architect wrote:
> > Is there a way to unload an already loaded script? Let's say, I put a
> >
On Sun, Aug 21, 2011 at 8:23 PM, Nick Morgan wrote:
> That was an incomplete refactoring! I did have two regex literals,
> then I assigned the first to `invalidIdentifier`, but forgot to
> replace the second regex literal with `invalidIdentifier` :/
>
> But yes, you're right, I could've just done
On Sat, Aug 27, 2011 at 1:00 AM, xavierm02 wrote:
> How to restore Object.prototype.hasOwnProperty if it has been overwritten?
>
>
Generally, you can't. There is nothing in the ECMAScript language
specification that allows you to restore a property after it has been
overwritten. After all, the or
On Tue, Sep 27, 2011 at 6:13 AM, Cheney, Austin <
austin.che...@travelocity.com> wrote:
> No, appendChild is a DOM property that adds a pointer from one DOM node, a
> parent, to another DOM node, a child. While a DOM node is represented in
> JavaScript as an object literal pointers, however, are
On Thu, Oct 6, 2011 at 2:17 PM, Fyodorov "bga" Alexander <
bga.em...@gmail.com> wrote:
>
> 1) convert your code to
> {
> const singletonObject = (function(){
>// helper fns
>
>return {
> // privare members
> newsItems_: [],
>
> _init: function(){
>// your object in
On Fri, Oct 7, 2011 at 12:09 PM, Fyodorov "bga" Alexander
wrote:
>
>
> reason why many js coders still use ; is because they use other old
> langs such as c++/java. New langs such as Go and Scala dont requires ;
> because in most cases \n is ;.
I agree on that, and in a language designed to not n
On Sun, Oct 23, 2011 at 1:40 PM, pete otaqui wrote:
>
> I wasn't really asking a question so much as noting down a useful observation
> I'd made.
>
> As you can see from my examples, it's not just the matches from the global
> RegExp that I'm after, it's also the sub patterns. These are never r
On Mon, Oct 24, 2011 at 9:05 PM, Bemi Faison wrote:
> Fair enough. I meant using Object.create() on the constructor function
> itself - not an object prototype.
> I don't consider using the new statement to be a hack. In light of the
> recent ES5 specification it could be considered a deprecated s
On Thu, Oct 27, 2011 at 10:30 AM, Rahul wrote:
> function fngg(){
> var f = function(){ alert(studentName); }
> var studentName = "Kate Adam Bikensale";
> return f;
> }
>
> now i can call the above function using window's onload event as
> follows,
>
> window.onload = fngg();
>
> this works
On Thu, Nov 3, 2011 at 5:34 AM, RobG wrote:
>
>
> On Nov 1, 7:06 pm, Anoop wrote:
>> As per the MDN documentation:
>> A for...in loop does not iterate over non–enumerable properties.
>> Objects created from built–in constructors like Array and Object have
>> inherited non–enumerable properties fr
On Mon, Nov 7, 2011 at 9:01 AM, Jarek Foksa wrote:
> While reading WebKit Inspector's sources I have stumbled upon syntax
> that I have not seen before, namely get & set keywords:
>
> var editor = {
> _startLine: 91,
>
> get startLine() {
> console.log('Getting start line');
> return this.
On Mon, Nov 7, 2011 at 12:42 PM, HankyPanky wrote:
> Ok, we are on the same page for expression AExpr || BExpr as I
> mentioned before. But what about: AExpr || (BExpr)
> Do you by implication mean that these two are the same? I mean are
> AExpr || BExpr and AExpr || (BExpr) treated equally?
Abso
On Thu, Nov 3, 2011 at 8:36 PM, dtang85 wrote:
> I know that it is considered best practice to place your scripts at
> the bottom of the page before the closing body tag. However, I started
> using Require.js recently and the Google Maps API, and both tell you
> to place your scripts in the head.
ote:
> I still don't really understand the "defer" attribute, but I also don't see
> the advantage, when you can just put your scripts as late in the document as
> possible.
>
> On Monday, November 7, 2011 7:50:18 AM UTC-5, Lasse Reichstein wrote:
>>
>> On
On Wed, Nov 16, 2011 at 7:37 AM, Rahul wrote:
> (function(){
>
> var personProto = {
> describe : function(){
> alert("NAME IS "+this.name);
> }
> };
>
> var jane = {
> name : "JANE",
> __proto
On Fri, Dec 9, 2011 at 8:57 PM, Bruno Jouhier wrote:
> The following prints "item=function" on IE9!!
>
>
> function foo() {
> item = "hello";
> alert("item=" + typeof item);
> }
> foo();
>
>
> Of course, it is lacking a "var" before "item", but the result is
> surprising.
Not real
On Fri, Dec 9, 2011 at 9:01 PM, Ryan Bales wrote:
> Ah, I see. I'm sure someone has more insight into the way that the IE js
> engine evaluates this, but I'm sure that it's concatenating typeof (which,
> when stringified would return 'function'), rather than the return value of
> typeof(item)
Ra
56 matches
Mail list logo