Be more strict with {Element} types

This commit is contained in:
Frederic Junod
2013-11-12 10:22:27 +01:00
parent 1560fbace3
commit ca5960666d
4 changed files with 13 additions and 9 deletions

View File

@@ -28,7 +28,7 @@ ol.webgl.WebGLContextEventType = {
/**
* @param {Element} canvas Canvas.
* @param {HTMLCanvasElement} canvas Canvas.
* @param {Object=} opt_attributes Attributes.
* @return {WebGLRenderingContext} WebGL rendering context.
*/
@@ -38,7 +38,7 @@ ol.webgl.getContext = function(canvas, opt_attributes) {
try {
context = canvas.getContext(ol.webgl.CONTEXT_IDS_[i], opt_attributes);
if (!goog.isNull(context)) {
return context;
return /** @type {!WebGLRenderingContext} */ (context);
}
} catch (e) {
}
@@ -57,7 +57,8 @@ ol.webgl.SUPPORTED = (function() {
return false;
}
try {
var canvas = goog.dom.createElement(goog.dom.TagName.CANVAS);
var canvas = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS));
return !goog.isNull(ol.webgl.getContext(canvas));
} catch (e) {
return false;