Subscribe: Comments on: How To Subclass The JavaScript Array Object
Added By: Feedage Forager Feedage Grade B rated
Language: English
array  dean edwards  dean  document  edwards  extract browsers  frames length  frames  javascript  jsbin ilehu  obj array  obj  object  started 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Comments on: How To Subclass The JavaScript Array Object

Comments on: How To Subclass The JavaScript Array Object

JavaScript, DHTML and browser hacking

Last Build Date: Sun, 17 Jul 2016 04:22:05 +0000


By: Eugene Kuzmenko

Tue, 02 Sep 2014 12:59:34 +0000

consider the following:

  1. frames === window
  2. frames[frames.length - 1] is also a window object, but of a newly created frame

thus your code can be simplified like this:

var iframe = document.createElement('iframe'); = 'none';
var Array2 = frames[frames.length - 1].Array;

which also eliminates the need for Array2 to be a global variable

By: Is the “iframe sandbox” technique safe? | Ask Programming & Technology

Thu, 07 Nov 2013 13:51:31 +0000

[...] [...]

By: JavaScript – Classes, Private Members, & Prototypal Inheritance | Chris West's Blog

Wed, 14 Nov 2012 16:04:15 +0000

[...] prototype functions to get access to private variables. I have to admit that this idea came from this post from JavaScript extraordinaire, Dean Edwards. Have [...]

By: Koh

Tue, 15 Mar 2011 20:13:02 +0000

Hello Matthew,

I know this post is old, but was hoping you could help me. Is there a way to make your code work with an already existing method? So basically I want to override the push method but still call it before doing the additional functionality I need. I made an example:

By: David

Fri, 31 Dec 2010 03:11:27 +0000

Awesome. Hours of googling has made me realize you're the one person who has ever written about this problem. I can't believe more people haven't run into it. Thanks for the writeup, even if it was from 4 years ago.

By: Recent Reading (JS Natives Duke it Out, Regexp in jQuery, Performance, a New Image Format?) » HTML + CSS + JavaScript » Blog Archive

Thu, 07 Oct 2010 19:08:08 +0000

[...] of screencasts about the core idea behind FuseJS. I clearly remember the Dean Edwards post that started it. Funny how the reaction to a technical musing could grow to such an impressive project. Interesting [...]

By: Perfection kills » How ECMAScript 5 still does not allow to subclass an array

Thu, 15 Jul 2010 16:07:52 +0000

[...] popular solution is by Dean Edwards. This one takes a completely different approach — instead of creating an object that inherits [...]

By: Richard Corsale

Tue, 23 Mar 2010 13:44:42 +0000

At some point several weeks ago I started thinking about building a Collections framework for JS that would mimic the feature set that we have in Java Collections. I started out with a class that used Arrays as storage repositories. I then realized that I was still leaving the door open to unintended copies of this object, getting passed around even if the core data repo was reference based. I found this tutorial and started weeks of experimentation sub-classing Array. Heres what I found,

1. A subclassed Array (obj.prototype = new Array) is many many orders of magnitude slower than obj = Array; that stands to reason.

2. so now I need to get Array as an assignment for the collection. ok... sub frame to extract for all browsers. Not Safari actually.. ok.. window to extract for all browsers.. not for FF 3.6, ok ... a combination, carving out the best method for the browser at hand. Let me tell ya, I've never had so much frustration as I did that week. When all was said and done:

3. An object that encapsulated the array, was just as fast as the obj=Array, and much faster than prototyping Array. That was a bit supprising at first, not so much once you think about what happens when you call "this" on an object's prototype (V8 engine is the exception). if the user wanted array functionality for direct iteration over large data sets he/she/i could get it at obj.array.

It's an interesting idea, in the end though, It's more trouble than its worth. That is, unless you have to have an object that has the special properties of Array. If that's the case. obj = Array; is your best bet ;-)

By: How Internet Explorer 8 document mode affects JavaScript | NCZOnline

Tue, 02 Feb 2010 13:01:16 +0000

[...] big change to arrays is the ability to properly inherit from the Array type. Dean Edwards has a whole post about trying to create a subtype of Array and the problems he encountered. The biggest problem is [...]

By: Javascript array prototyping in namespace -

Mon, 12 Oct 2009 12:45:51 +0000

[...] einen interessanten Artikel von Dean Edwards gefunden, der genau das macht. Allerdings erzeugt er noch zusätzlich einen unsichtbaren iframe. Da [...]