JonazMartinez / explorercanvas

Automatically exported from code.google.com/p/explorercanvas
Apache License 2.0
0 stars 0 forks source link

Dynamic creation of canvas #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Override document.createElement('canvas') to do the initialization.

Original report at:

https://sourceforge.net/tracker/index.php?
func=detail&aid=1470272&group_id=163391&atid=827563

Original issue reported on code.google.com by erik.arv...@gmail.com on 2 Mar 2009 at 12:31

GoogleCodeExporter commented 9 years ago
when you go to
https://sourceforge.net/tracker/index.php?func=detail&aid=1470272&group_id=16339
1&atid=827563
it says the tracker has been disabled for the group... so i can't reference the
original ticket... could someone possibly repost it and update the ticket here?

Original comment by weare...@gmail.com on 25 Mar 2009 at 2:54

GoogleCodeExporter commented 9 years ago
The problem is that overriding document.createElement is far from sufficient. 
There 
are a lot of ways to create elements and you can always use initElement as a 
work 
aroound.

Original comment by erik.arv...@gmail.com on 25 Mar 2009 at 6:22

GoogleCodeExporter commented 9 years ago
This topic came up again on the discussion group. Here is the thread:

http://groups.google.com/group/google-excanvas/t/4297a91783f9b170

The result was that not only is patching document.createElement insufficient, 
because it doesn't catch the other 
ways canvas elements can be created, but it also imposes a performance penalty 
for every element you want to 
create that is *not* a canvas. Hence the decision was not to implement this. So 
I think this ticket can be closed 
as "won't fix". Perhaps before that is done the issue's title could be made 
more specific.

Original comment by ryandesi...@gmail.com on 19 May 2009 at 10:58

GoogleCodeExporter commented 9 years ago
Issue 46 has been merged into this issue.

Original comment by erik.arv...@gmail.com on 17 Sep 2009 at 2:13

GoogleCodeExporter commented 9 years ago

Original comment by erik.arv...@gmail.com on 17 Sep 2009 at 2:14

GoogleCodeExporter commented 9 years ago
Though this still suffers from the performance issue (and therefore presumably 
won't cause a reconsideration), for those seeking their own workaround, the 
following ought to solve the issue with the other ways canvas elements may be 
created:

Add the following at the very end of the closure:

  if (typeof HTMLDocument !== 'undefined') {
    var oldCreateElement = document.createElement;
    HTMLDocument.prototype.createElement = function (el) {
      if (el.toLowerCase() === 'canvas') {
        var canvas = oldCreateElement.call(this, el);
        G_vmlCanvasManager.initElement(canvas);
        return canvas;
      }
      return oldCreateElement.call(this, el);
    };
  }

Original comment by bret...@gmail.com on 11 Apr 2014 at 1:58

Attachments: