From 9195f026d73c17706052995478a1db6e31c5eb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 1 Aug 2011 16:18:17 +0100 Subject: [PATCH] Support passing canvas ids straight to View constructor. --- src/ui/View.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/View.js b/src/ui/View.js index 42134110..29c9c573 100644 --- a/src/ui/View.js +++ b/src/ui/View.js @@ -35,7 +35,9 @@ var View = this.View = Base.extend(/** @lends View# */{ this._index = this._scope.views.push(this) - 1; // Handle canvas argument var size; - if (canvas && canvas instanceof HTMLCanvasElement) { + if (typeof canvas === 'string') + canvas = document.getElementById(canvas); + if (canvas instanceof HTMLCanvasElement) { this._canvas = canvas; // If the canvas has the resize attribute, resize the it to fill the // window and resize it again whenever the user resizes the window.