From 947b04979955a8d20b9f6250c49d864fb362ff70 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 21 Aug 2014 14:46:10 -0600 Subject: [PATCH 1/2] Rename ol.browserfeature to ol.has --- examples/bind-input.js | 6 ++--- examples/brightness-contrast.js | 4 +-- examples/hue-saturation.js | 4 +-- examples/layer-clipping-webgl.js | 4 +-- examples/side-by-side.js | 4 +-- examples/wmts-hidpi.js | 4 +-- src/ol/binary.js | 4 +-- src/ol/browserfeature.jsdoc | 3 --- src/ol/deviceorientation.js | 4 +-- src/ol/format/binaryfeatureformat.js | 4 +-- src/ol/geolocation.js | 4 +-- src/ol/{browserfeature.js => has.js} | 26 +++++++++---------- src/ol/has.jsdoc | 3 +++ src/ol/map.js | 12 ++++----- src/ol/pointer/pointereventhandler.js | 8 +++--- src/ol/render/canvas/canvasimmediate.js | 6 ++--- src/ol/render/canvas/canvasreplay.js | 4 +-- src/ol/source/formatvectorsource.js | 6 ++--- test/spec/ol/pointer/mousesource.test.js | 8 +++--- .../ol/pointer/pointereventhandler.test.js | 6 ++--- test/spec/ol/pointer/touchsource.test.js | 8 +++--- 21 files changed, 66 insertions(+), 66 deletions(-) delete mode 100644 src/ol/browserfeature.jsdoc rename src/ol/{browserfeature.js => has.js} (75%) create mode 100644 src/ol/has.jsdoc diff --git a/examples/bind-input.js b/examples/bind-input.js index dba68a68eb..5940453060 100644 --- a/examples/bind-input.js +++ b/examples/bind-input.js @@ -1,17 +1,17 @@ goog.require('ol.Map'); goog.require('ol.View'); -goog.require('ol.browserfeature'); goog.require('ol.control'); goog.require('ol.dom.Input'); +goog.require('ol.has'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); function checkWebGL(evt) { document.getElementById('no-webgl').style.display = - ol.browserfeature.HAS_WEBGL ? 'none' : ''; + ol.has.WEBGL ? 'none' : ''; document.getElementById('has-webgl').style.display = - ol.browserfeature.HAS_WEBGL && !evt.glContext ? '' : 'none'; + ol.has.WEBGL && !evt.glContext ? '' : 'none'; document.getElementById('webgl').style.display = evt.glContext ? '' : 'none'; } diff --git a/examples/brightness-contrast.js b/examples/brightness-contrast.js index c5b80f6345..b5d38b0f89 100644 --- a/examples/brightness-contrast.js +++ b/examples/brightness-contrast.js @@ -1,6 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.layer.Tile'); goog.require('ol.source.MapQuest'); @@ -14,7 +14,7 @@ function setResetContrastButtonHTML() { resetContrast.innerHTML = 'Contrast (' + layer.getContrast().toFixed(3) + ')'; } -if (!ol.browserfeature.HAS_WEBGL) { +if (!ol.has.WEBGL) { var info = document.getElementById('no-webgl'); /** * display error message diff --git a/examples/hue-saturation.js b/examples/hue-saturation.js index ff85058fd5..6d163f9790 100644 --- a/examples/hue-saturation.js +++ b/examples/hue-saturation.js @@ -1,6 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.layer.Tile'); goog.require('ol.proj'); goog.require('ol.source.BingMaps'); @@ -15,7 +15,7 @@ function setResetSaturationButtonHTML() { layer.getSaturation().toFixed(2) + ')'; } -if (!ol.browserfeature.HAS_WEBGL) { +if (!ol.has.WEBGL) { var info = document.getElementById('no-webgl'); /** * display error message diff --git a/examples/layer-clipping-webgl.js b/examples/layer-clipping-webgl.js index 2aa3a90a74..602678236d 100644 --- a/examples/layer-clipping-webgl.js +++ b/examples/layer-clipping-webgl.js @@ -1,11 +1,11 @@ goog.require('ol.Map'); goog.require('ol.View'); -goog.require('ol.browserfeature'); goog.require('ol.control'); +goog.require('ol.has'); goog.require('ol.layer.Tile'); goog.require('ol.source.OSM'); -if (!ol.browserfeature.HAS_WEBGL) { +if (!ol.has.WEBGL) { var info = document.getElementById('no-webgl'); /** * display error message diff --git a/examples/side-by-side.js b/examples/side-by-side.js index b4467e36bc..a58340b378 100644 --- a/examples/side-by-side.js +++ b/examples/side-by-side.js @@ -1,6 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.layer.Tile'); goog.require('ol.source.MapQuest'); @@ -19,7 +19,7 @@ var domMap = new ol.Map({ }) }); -if (ol.browserfeature.HAS_WEBGL) { +if (ol.has.WEBGL) { var webglMap = new ol.Map({ renderer: 'webgl', target: 'webglMap' diff --git a/examples/wmts-hidpi.js b/examples/wmts-hidpi.js index 4b27740568..682a08c5fb 100644 --- a/examples/wmts-hidpi.js +++ b/examples/wmts-hidpi.js @@ -1,6 +1,6 @@ goog.require('ol.Map'); goog.require('ol.View'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.layer.Tile'); goog.require('ol.source.WMTS'); goog.require('ol.tilegrid.WMTS'); @@ -20,7 +20,7 @@ var urls = [ // HiDPI support: // * Use 'bmaphidpi' layer (pixel ratio 2) for device pixel ratio > 1 // * Use 'geolandbasemap' layer (pixel ratio 1) for device pixel ratio == 1 -var hiDPI = ol.browserfeature.DEVICE_PIXEL_RATIO > 1; +var hiDPI = ol.has.DEVICE_PIXEL_RATIO > 1; var source = new ol.source.WMTS({ projection: 'EPSG:3857', diff --git a/src/ol/binary.js b/src/ol/binary.js index 107a542511..05e0086c25 100644 --- a/src/ol/binary.js +++ b/src/ol/binary.js @@ -5,7 +5,7 @@ goog.provide('ol.binary.IReader'); goog.require('goog.asserts'); goog.require('goog.userAgent'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); @@ -29,7 +29,7 @@ ol.binary.Buffer = function(data) { */ ol.binary.Buffer.prototype.getReader = function() { var data = this.data_; - if (ol.browserfeature.HAS_ARRAY_BUFFER) { + if (ol.has.ARRAY_BUFFER) { var arrayBuffer; if (data instanceof ArrayBuffer) { arrayBuffer = data; diff --git a/src/ol/browserfeature.jsdoc b/src/ol/browserfeature.jsdoc deleted file mode 100644 index 151b6b12eb..0000000000 --- a/src/ol/browserfeature.jsdoc +++ /dev/null @@ -1,3 +0,0 @@ -/** - * @namespace ol.browserfeature - */ diff --git a/src/ol/deviceorientation.js b/src/ol/deviceorientation.js index 81528b84e2..9b721246b7 100644 --- a/src/ol/deviceorientation.js +++ b/src/ol/deviceorientation.js @@ -4,7 +4,7 @@ goog.provide('ol.DeviceOrientationProperty'); goog.require('goog.events'); goog.require('goog.math'); goog.require('ol.Object'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); /** @@ -221,7 +221,7 @@ goog.exportProperty( * @private */ ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() { - if (ol.browserfeature.HAS_DEVICE_ORIENTATION) { + if (ol.has.DEVICE_ORIENTATION) { var tracking = this.getTracking(); if (tracking && goog.isNull(this.listenerKey_)) { this.listenerKey_ = goog.events.listen(goog.global, 'deviceorientation', diff --git a/src/ol/format/binaryfeatureformat.js b/src/ol/format/binaryfeatureformat.js index 306737608d..ff84c4dd2b 100644 --- a/src/ol/format/binaryfeatureformat.js +++ b/src/ol/format/binaryfeatureformat.js @@ -2,9 +2,9 @@ goog.provide('ol.format.BinaryFeature'); goog.require('goog.asserts'); goog.require('ol.binary.Buffer'); -goog.require('ol.browserfeature'); goog.require('ol.format.Feature'); goog.require('ol.format.FormatType'); +goog.require('ol.has'); goog.require('ol.proj'); @@ -25,7 +25,7 @@ goog.inherits(ol.format.BinaryFeature, ol.format.Feature); * @return {ol.binary.Buffer} Buffer. */ ol.format.BinaryFeature.getBuffer_ = function(source) { - if (ol.browserfeature.HAS_ARRAY_BUFFER && source instanceof ArrayBuffer) { + if (ol.has.ARRAY_BUFFER && source instanceof ArrayBuffer) { return new ol.binary.Buffer(source); } else if (goog.isString(source)) { return new ol.binary.Buffer(source); diff --git a/src/ol/geolocation.js b/src/ol/geolocation.js index caa2dde60d..9d304dcec9 100644 --- a/src/ol/geolocation.js +++ b/src/ol/geolocation.js @@ -8,9 +8,9 @@ goog.require('goog.events.EventType'); goog.require('goog.math'); goog.require('ol.Coordinate'); goog.require('ol.Object'); -goog.require('ol.browserfeature'); goog.require('ol.geom.Geometry'); goog.require('ol.geom.Polygon'); +goog.require('ol.has'); goog.require('ol.proj'); goog.require('ol.sphere.WGS84'); @@ -130,7 +130,7 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() { * @private */ ol.Geolocation.prototype.handleTrackingChanged_ = function() { - if (ol.browserfeature.HAS_GEOLOCATION) { + if (ol.has.GEOLOCATION) { var tracking = this.getTracking(); if (tracking && !goog.isDef(this.watchId_)) { this.watchId_ = goog.global.navigator.geolocation.watchPosition( diff --git a/src/ol/browserfeature.js b/src/ol/has.js similarity index 75% rename from src/ol/browserfeature.js rename to src/ol/has.js index bd0ddac354..8a4af5fa2b 100644 --- a/src/ol/browserfeature.js +++ b/src/ol/has.js @@ -1,4 +1,4 @@ -goog.provide('ol.browserfeature'); +goog.provide('ol.has'); goog.require('goog.dom'); goog.require('goog.dom.TagName'); @@ -14,7 +14,7 @@ goog.require('ol.webgl'); * @type {number} * @api */ -ol.browserfeature.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1; +ol.has.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1; /** @@ -22,14 +22,14 @@ ol.browserfeature.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1; * @const * @type {boolean} */ -ol.browserfeature.HAS_ARRAY_BUFFER = 'ArrayBuffer' in goog.global; +ol.has.ARRAY_BUFFER = 'ArrayBuffer' in goog.global; /** * True if the browser's Canvas implementation implements {get,set}LineDash. * @type {boolean} */ -ol.browserfeature.HAS_CANVAS_LINE_DASH = false; +ol.has.CANVAS_LINE_DASH = false; /** @@ -38,7 +38,7 @@ ol.browserfeature.HAS_CANVAS_LINE_DASH = false; * @type {boolean} * @api */ -ol.browserfeature.HAS_CANVAS = ol.ENABLE_CANVAS && ( +ol.has.CANVAS = ol.ENABLE_CANVAS && ( /** * @return {boolean} Canvas supported. */ @@ -52,7 +52,7 @@ ol.browserfeature.HAS_CANVAS = ol.ENABLE_CANVAS && ( return false; } else { if (goog.isDef(context.setLineDash)) { - ol.browserfeature.HAS_CANVAS_LINE_DASH = true; + ol.has.CANVAS_LINE_DASH = true; } return true; } @@ -68,7 +68,7 @@ ol.browserfeature.HAS_CANVAS = ol.ENABLE_CANVAS && ( * @type {boolean} * @api */ -ol.browserfeature.HAS_DEVICE_ORIENTATION = +ol.has.DEVICE_ORIENTATION = 'DeviceOrientationEvent' in goog.global; @@ -77,7 +77,7 @@ ol.browserfeature.HAS_DEVICE_ORIENTATION = * @const * @type {boolean} */ -ol.browserfeature.HAS_DOM = ol.ENABLE_DOM; +ol.has.DOM = ol.ENABLE_DOM; /** @@ -86,7 +86,7 @@ ol.browserfeature.HAS_DOM = ol.ENABLE_DOM; * @type {boolean} * @api */ -ol.browserfeature.HAS_GEOLOCATION = 'geolocation' in goog.global.navigator; +ol.has.GEOLOCATION = 'geolocation' in goog.global.navigator; /** @@ -95,7 +95,7 @@ ol.browserfeature.HAS_GEOLOCATION = 'geolocation' in goog.global.navigator; * @type {boolean} * @api */ -ol.browserfeature.HAS_TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global; +ol.has.TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global; /** @@ -103,7 +103,7 @@ ol.browserfeature.HAS_TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global; * @const * @type {boolean} */ -ol.browserfeature.HAS_POINTER = 'PointerEvent' in goog.global; +ol.has.POINTER = 'PointerEvent' in goog.global; /** @@ -111,7 +111,7 @@ ol.browserfeature.HAS_POINTER = 'PointerEvent' in goog.global; * @const * @type {boolean} */ -ol.browserfeature.HAS_MSPOINTER = +ol.has.MSPOINTER = !!(goog.global.navigator.msPointerEnabled); @@ -121,7 +121,7 @@ ol.browserfeature.HAS_MSPOINTER = * @type {boolean} * @api */ -ol.browserfeature.HAS_WEBGL = ol.ENABLE_WEBGL && ( +ol.has.WEBGL = ol.ENABLE_WEBGL && ( /** * @return {boolean} WebGL supported. */ diff --git a/src/ol/has.jsdoc b/src/ol/has.jsdoc new file mode 100644 index 0000000000..ca1dca69ab --- /dev/null +++ b/src/ol/has.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol.has + */ diff --git a/src/ol/map.js b/src/ol/map.js index 1879836762..f19573c8f5 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -45,9 +45,9 @@ goog.require('ol.Size'); goog.require('ol.TileQueue'); goog.require('ol.View'); goog.require('ol.ViewHint'); -goog.require('ol.browserfeature'); goog.require('ol.control'); goog.require('ol.extent'); +goog.require('ol.has'); goog.require('ol.interaction'); goog.require('ol.layer.Base'); goog.require('ol.layer.Group'); @@ -170,7 +170,7 @@ ol.Map = function(options) { * @type {number} */ this.pixelRatio_ = goog.isDef(options.pixelRatio) ? - options.pixelRatio : ol.browserfeature.DEVICE_PIXEL_RATIO; + options.pixelRatio : ol.has.DEVICE_PIXEL_RATIO; /** * @private @@ -240,7 +240,7 @@ ol.Map = function(options) { this.viewport_.style.height = '100%'; // prevent page zoom on IE >= 10 browsers this.viewport_.style.msTouchAction = 'none'; - if (ol.browserfeature.HAS_TOUCH) { + if (ol.has.TOUCH) { this.viewport_.className = 'ol-touch'; } @@ -1465,17 +1465,17 @@ ol.Map.createOptionsInternal = function(options) { /** @type {ol.RendererType} */ var rendererType = rendererTypes[i]; if (ol.ENABLE_CANVAS && rendererType == ol.RendererType.CANVAS) { - if (ol.browserfeature.HAS_CANVAS) { + if (ol.has.CANVAS) { rendererConstructor = ol.renderer.canvas.Map; break; } } else if (ol.ENABLE_DOM && rendererType == ol.RendererType.DOM) { - if (ol.browserfeature.HAS_DOM) { + if (ol.has.DOM) { rendererConstructor = ol.renderer.dom.Map; break; } } else if (ol.ENABLE_WEBGL && rendererType == ol.RendererType.WEBGL) { - if (ol.browserfeature.HAS_WEBGL) { + if (ol.has.WEBGL) { rendererConstructor = ol.renderer.webgl.Map; break; } diff --git a/src/ol/pointer/pointereventhandler.js b/src/ol/pointer/pointereventhandler.js index 48038ef793..367fb77193 100644 --- a/src/ol/pointer/pointereventhandler.js +++ b/src/ol/pointer/pointereventhandler.js @@ -36,7 +36,7 @@ goog.require('goog.events.BrowserEvent'); goog.require('goog.events.Event'); goog.require('goog.events.EventTarget'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.pointer.MouseSource'); goog.require('ol.pointer.MsSource'); goog.require('ol.pointer.NativeSource'); @@ -88,15 +88,15 @@ goog.inherits(ol.pointer.PointerEventHandler, goog.events.EventTarget); * that generate pointer events. */ ol.pointer.PointerEventHandler.prototype.registerSources = function() { - if (ol.browserfeature.HAS_POINTER) { + if (ol.has.POINTER) { this.registerSource('native', new ol.pointer.NativeSource(this)); - } else if (ol.browserfeature.HAS_MSPOINTER) { + } else if (ol.has.MSPOINTER) { this.registerSource('ms', new ol.pointer.MsSource(this)); } else { var mouseSource = new ol.pointer.MouseSource(this); this.registerSource('mouse', mouseSource); - if (ol.browserfeature.HAS_TOUCH) { + if (ol.has.TOUCH) { this.registerSource('touch', new ol.pointer.TouchSource(this, mouseSource)); } diff --git a/src/ol/render/canvas/canvasimmediate.js b/src/ol/render/canvas/canvasimmediate.js index 84658d0b54..c263b01554 100644 --- a/src/ol/render/canvas/canvasimmediate.js +++ b/src/ol/render/canvas/canvasimmediate.js @@ -8,10 +8,10 @@ goog.require('goog.array'); goog.require('goog.asserts'); goog.require('goog.object'); goog.require('goog.vec.Mat4'); -goog.require('ol.browserfeature'); goog.require('ol.color'); goog.require('ol.extent'); goog.require('ol.geom.flat.transform'); +goog.require('ol.has'); goog.require('ol.render.IVectorContext'); goog.require('ol.render.canvas'); goog.require('ol.vec.Mat4'); @@ -764,7 +764,7 @@ ol.render.canvas.Immediate.prototype.setContextStrokeState_ = var contextStrokeState = this.contextStrokeState_; if (goog.isNull(contextStrokeState)) { context.lineCap = strokeState.lineCap; - if (ol.browserfeature.HAS_CANVAS_LINE_DASH) { + if (ol.has.CANVAS_LINE_DASH) { context.setLineDash(strokeState.lineDash); } context.lineJoin = strokeState.lineJoin; @@ -783,7 +783,7 @@ ol.render.canvas.Immediate.prototype.setContextStrokeState_ = if (contextStrokeState.lineCap != strokeState.lineCap) { contextStrokeState.lineCap = context.lineCap = strokeState.lineCap; } - if (ol.browserfeature.HAS_CANVAS_LINE_DASH) { + if (ol.has.CANVAS_LINE_DASH) { if (!goog.array.equals( contextStrokeState.lineDash, strokeState.lineDash)) { context.setLineDash(contextStrokeState.lineDash = strokeState.lineDash); diff --git a/src/ol/render/canvas/canvasreplay.js b/src/ol/render/canvas/canvasreplay.js index 88b70761a1..5d7b35aef6 100644 --- a/src/ol/render/canvas/canvasreplay.js +++ b/src/ol/render/canvas/canvasreplay.js @@ -9,13 +9,13 @@ goog.require('goog.asserts'); goog.require('goog.object'); goog.require('goog.vec.Mat4'); goog.require('ol.array'); -goog.require('ol.browserfeature'); goog.require('ol.color'); goog.require('ol.dom'); goog.require('ol.extent'); goog.require('ol.extent.Relationship'); goog.require('ol.geom.flat.simplify'); goog.require('ol.geom.flat.transform'); +goog.require('ol.has'); goog.require('ol.render.IReplayGroup'); goog.require('ol.render.IVectorContext'); goog.require('ol.render.canvas'); @@ -425,7 +425,7 @@ ol.render.canvas.Replay.prototype.replay_ = function( context.lineCap = /** @type {string} */ (instruction[3]); context.lineJoin = /** @type {string} */ (instruction[4]); context.miterLimit = /** @type {number} */ (instruction[5]); - if (ol.browserfeature.HAS_CANVAS_LINE_DASH) { + if (ol.has.CANVAS_LINE_DASH) { context.setLineDash(/** @type {Array.} */ (instruction[6])); } ++i; diff --git a/src/ol/source/formatvectorsource.js b/src/ol/source/formatvectorsource.js index ff87c4e46a..d75786b95a 100644 --- a/src/ol/source/formatvectorsource.js +++ b/src/ol/source/formatvectorsource.js @@ -10,8 +10,8 @@ goog.require('goog.net.EventType'); goog.require('goog.net.XhrIo'); goog.require('goog.net.XhrIo.ResponseType'); goog.require('goog.userAgent'); -goog.require('ol.browserfeature'); goog.require('ol.format.FormatType'); +goog.require('ol.has'); goog.require('ol.proj'); goog.require('ol.source.State'); goog.require('ol.source.Vector'); @@ -60,7 +60,7 @@ ol.source.FormatVector.prototype.loadFeaturesFromURL = var responseType; // FIXME maybe use ResponseType.DOCUMENT? if (type == ol.format.FormatType.BINARY && - ol.browserfeature.HAS_ARRAY_BUFFER) { + ol.has.ARRAY_BUFFER) { responseType = goog.net.XhrIo.ResponseType.ARRAY_BUFFER; } else { responseType = goog.net.XhrIo.ResponseType.TEXT; @@ -80,7 +80,7 @@ ol.source.FormatVector.prototype.loadFeaturesFromURL = /** @type {ArrayBuffer|Document|Node|Object|string|undefined} */ var source; if (type == ol.format.FormatType.BINARY && - ol.browserfeature.HAS_ARRAY_BUFFER) { + ol.has.ARRAY_BUFFER) { source = xhrIo.getResponse(); goog.asserts.assertInstanceof(source, ArrayBuffer); } else if (type == ol.format.FormatType.JSON) { diff --git a/test/spec/ol/pointer/mousesource.test.js b/test/spec/ol/pointer/mousesource.test.js index 18f49b5cc6..624dc27da6 100644 --- a/test/spec/ol/pointer/mousesource.test.js +++ b/test/spec/ol/pointer/mousesource.test.js @@ -11,9 +11,9 @@ describe('ol.pointer.MouseSource', function() { target = goog.dom.createElement(goog.dom.TagName.DIV); // make sure that a mouse and touch event source is used - ol.browserfeature.HAS_POINTER = false; - ol.browserfeature.HAS_MSPOINTER = false; - ol.browserfeature.HAS_TOUCH = true; + ol.has.POINTER = false; + ol.has.MSPOINTER = false; + ol.has.TOUCH = true; handler = new ol.pointer.PointerEventHandler(target); eventSpy = sinon.spy(); @@ -95,7 +95,7 @@ goog.require('goog.dom'); goog.require('goog.dom.TagName'); goog.require('goog.events'); goog.require('goog.events.BrowserEvent'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.pointer.MouseSource'); goog.require('ol.pointer.PointerEvent'); goog.require('ol.pointer.PointerEventHandler'); diff --git a/test/spec/ol/pointer/pointereventhandler.test.js b/test/spec/ol/pointer/pointereventhandler.test.js index 8804005f75..aa12df462f 100644 --- a/test/spec/ol/pointer/pointereventhandler.test.js +++ b/test/spec/ol/pointer/pointereventhandler.test.js @@ -9,8 +9,8 @@ describe('ol.pointer.PointerEventHandler', function() { target = goog.dom.createElement(goog.dom.TagName.DIV); // make sure that a mouse event source is used - ol.browserfeature.HAS_POINTER = false; - ol.browserfeature.HAS_MSPOINTER = false; + ol.has.POINTER = false; + ol.has.MSPOINTER = false; handler = new ol.pointer.PointerEventHandler(target); eventSpy = sinon.spy(); @@ -164,7 +164,7 @@ goog.require('goog.dom'); goog.require('goog.dom.TagName'); goog.require('goog.events'); goog.require('goog.events.BrowserEvent'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.pointer.MouseSource'); goog.require('ol.pointer.PointerEvent'); goog.require('ol.pointer.PointerEventHandler'); diff --git a/test/spec/ol/pointer/touchsource.test.js b/test/spec/ol/pointer/touchsource.test.js index f4a7010275..c5d6be0b92 100644 --- a/test/spec/ol/pointer/touchsource.test.js +++ b/test/spec/ol/pointer/touchsource.test.js @@ -11,9 +11,9 @@ describe('ol.pointer.TouchSource', function() { target = goog.dom.createElement(goog.dom.TagName.DIV); // make sure that a mouse and touch event source is used - ol.browserfeature.HAS_POINTER = false; - ol.browserfeature.HAS_MSPOINTER = false; - ol.browserfeature.HAS_TOUCH = true; + ol.has.POINTER = false; + ol.has.MSPOINTER = false; + ol.has.TOUCH = true; handler = new ol.pointer.PointerEventHandler(target); eventSpy = sinon.spy(); @@ -133,7 +133,7 @@ goog.require('goog.dom'); goog.require('goog.dom.TagName'); goog.require('goog.events'); goog.require('goog.events.BrowserEvent'); -goog.require('ol.browserfeature'); +goog.require('ol.has'); goog.require('ol.pointer.PointerEvent'); goog.require('ol.pointer.PointerEventHandler'); goog.require('ol.pointer.TouchSource'); From f11e5de156f2db5fb92fccdaadb9d034b0e00413 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 22 Aug 2014 07:36:05 -0600 Subject: [PATCH 2/2] Mark exportable ol.has properties as stable --- src/ol/has.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ol/has.js b/src/ol/has.js index 8a4af5fa2b..982156300c 100644 --- a/src/ol/has.js +++ b/src/ol/has.js @@ -12,7 +12,7 @@ goog.require('ol.webgl'); * (dips) on the device (`window.devicePixelRatio`). * @const * @type {number} - * @api + * @api stable */ ol.has.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1; @@ -36,7 +36,7 @@ ol.has.CANVAS_LINE_DASH = false; * True if browser supports Canvas. * @const * @type {boolean} - * @api + * @api stable */ ol.has.CANVAS = ol.ENABLE_CANVAS && ( /** @@ -66,7 +66,7 @@ ol.has.CANVAS = ol.ENABLE_CANVAS && ( * Indicates if DeviceOrientation is supported in the user's browser. * @const * @type {boolean} - * @api + * @api stable */ ol.has.DEVICE_ORIENTATION = 'DeviceOrientationEvent' in goog.global; @@ -84,7 +84,7 @@ ol.has.DOM = ol.ENABLE_DOM; * Is HTML5 geolocation supported in the current browser? * @const * @type {boolean} - * @api + * @api stable */ ol.has.GEOLOCATION = 'geolocation' in goog.global.navigator; @@ -93,7 +93,7 @@ ol.has.GEOLOCATION = 'geolocation' in goog.global.navigator; * True if browser supports touch events. * @const * @type {boolean} - * @api + * @api stable */ ol.has.TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global; @@ -119,7 +119,7 @@ ol.has.MSPOINTER = * True if browser supports WebGL. * @const * @type {boolean} - * @api + * @api stable */ ol.has.WEBGL = ol.ENABLE_WEBGL && ( /**