diff --git a/src/ol/control/mousepositioncontrol.js b/src/ol/control/mousepositioncontrol.js index bb8e2a01d8..45ae53e82c 100644 --- a/src/ol/control/mousepositioncontrol.js +++ b/src/ol/control/mousepositioncontrol.js @@ -2,7 +2,6 @@ goog.provide('ol.control.MousePosition'); -goog.require('goog.dom'); goog.require('ol.events'); goog.require('ol.events.EventType'); goog.require('ol.CoordinateFormatType'); @@ -40,10 +39,8 @@ ol.control.MousePosition = function(opt_options) { var options = opt_options ? opt_options : {}; - var className = options.className !== undefined ? options.className : - 'ol-mouse-position'; - - var element = goog.dom.createDom('DIV', className); + var element = document.createElement('DIV'); + element.className = options.className !== undefined ? options.className : 'ol-mouse-position' var render = options.render ? options.render : ol.control.MousePosition.render; diff --git a/src/ol/control/overviewmapcontrol.js b/src/ol/control/overviewmapcontrol.js index 020fc25d21..0abd7dd7ab 100644 --- a/src/ol/control/overviewmapcontrol.js +++ b/src/ol/control/overviewmapcontrol.js @@ -86,7 +86,8 @@ ol.control.OverviewMap = function(opt_options) { ol.events.listen(button, ol.events.EventType.CLICK, this.handleClick_, this); - var ovmapDiv = goog.dom.createDom('DIV', 'ol-overviewmap-map'); + var ovmapDiv = document.createElement('DIV'); + ovmapDiv.className = 'ol-overviewmap-map'; /** * @type {ol.Map} diff --git a/src/ol/control/scalelinecontrol.js b/src/ol/control/scalelinecontrol.js index 7de1873943..e8ce86586b 100644 --- a/src/ol/control/scalelinecontrol.js +++ b/src/ol/control/scalelinecontrol.js @@ -3,7 +3,6 @@ goog.provide('ol.control.ScaleLineProperty'); goog.provide('ol.control.ScaleLineUnits'); goog.require('goog.asserts'); -goog.require('goog.dom'); goog.require('ol.events'); goog.require('goog.style'); goog.require('ol'); @@ -61,14 +60,16 @@ ol.control.ScaleLine = function(opt_options) { * @private * @type {Element} */ - this.innerElement_ = goog.dom.createDom('DIV', className + '-inner'); + this.innerElement_ = document.createElement('DIV'); + this.innerElement_.className = className + '-inner'; /** * @private * @type {Element} */ - this.element_ = goog.dom.createDom('DIV', - className + ' ' + ol.css.CLASS_UNSELECTABLE, this.innerElement_); + this.element_ = document.createElement('DIV'); + this.element_.className = className + ' ' + ol.css.CLASS_UNSELECTABLE; + this.element_.appendChild(this.innerElement_); /** * @private diff --git a/test/spec/ol/control/control.test.js b/test/spec/ol/control/control.test.js index 68ce246b73..6f45fd2ab1 100644 --- a/test/spec/ol/control/control.test.js +++ b/test/spec/ol/control/control.test.js @@ -7,7 +7,7 @@ describe('ol.control.Control', function() { map = new ol.Map({ target: document.createElement('div') }); - var element = goog.dom.createDom('DIV'); + var element = document.createElement('DIV'); control = new ol.control.Control({element: element}); control.setMap(map); }); @@ -27,14 +27,16 @@ describe('ol.control.Control', function() { describe('ol.control.Control\'s target', function() { describe('target as string or element', function() { it('transforms target from string to element', function() { - var target = goog.dom.createDom('div', {'id': 'mycontrol'}); + var target = document.createElement('div'); + target.id = 'mycontrol'; document.body.appendChild(target); var ctrl = new ol.control.Control({target: 'mycontrol'}); expect(ctrl.target_.id).to.equal('mycontrol'); goog.dispose(ctrl); }); it('accepts element for target', function() { - var target = goog.dom.createDom('div', {'id': 'mycontrol'}); + var target = document.createElement('div'); + target.id = 'mycontrol'; document.body.appendChild(target); var ctrl = new ol.control.Control({target: target}); expect(ctrl.target_.id).to.equal('mycontrol'); diff --git a/test/spec/ol/control/mousepositioncontrol.test.js b/test/spec/ol/control/mousepositioncontrol.test.js index 6409d2c12f..bf1d0029cd 100644 --- a/test/spec/ol/control/mousepositioncontrol.test.js +++ b/test/spec/ol/control/mousepositioncontrol.test.js @@ -7,6 +7,15 @@ describe('ol.control.MousePosition', function() { it('can be constructed without arguments', function() { var instance = new ol.control.MousePosition(); expect(instance).to.be.an(ol.control.MousePosition); + expect(instance.element.className).to.be('ol-mouse-position'); + }); + + it('creates the element with the provided class name', function() { + var className = 'foobar'; + var instance = new ol.control.MousePosition({ + className: className + }); + expect(instance.element.className).to.be(className); }); });