Merge pull request #4474 from fredj/rm_goog.dom

Remove use of goog.dom.createElement and goog.dom.createTextNode
This commit is contained in:
Frédéric Junod
2015-11-23 09:54:00 +01:00
11 changed files with 21 additions and 25 deletions

View File

@@ -37,13 +37,13 @@ ol.control.Attribution = function(opt_options) {
* @private
* @type {Element}
*/
this.ulElement_ = goog.dom.createElement('UL');
this.ulElement_ = document.createElement('UL');
/**
* @private
* @type {Element}
*/
this.logoLi_ = goog.dom.createElement('LI');
this.logoLi_ = document.createElement('LI');
this.ulElement_.appendChild(this.logoLi_);
goog.style.setElementShown(this.logoLi_, false);
@@ -261,7 +261,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
}
}
for (attributionKey in visibleAttributions) {
attributionElement = goog.dom.createElement('LI');
attributionElement = document.createElement('LI');
attributionElement.innerHTML =
visibleAttributions[attributionKey].getHTML();
this.ulElement_.appendChild(attributionElement);
@@ -269,7 +269,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
this.attributionElementRenderedVisible_[attributionKey] = true;
}
for (attributionKey in hiddenAttributions) {
attributionElement = goog.dom.createElement('LI');
attributionElement = document.createElement('LI');
attributionElement.innerHTML =
hiddenAttributions[attributionKey].getHTML();
goog.style.setElementShown(attributionElement, false);

View File

@@ -43,7 +43,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {Node}
*/
this.labelNode_ = goog.isString(label) ?
goog.dom.createTextNode(label) : label;
document.createTextNode(label) : label;
var labelActive = options.labelActive ? options.labelActive : '\u00d7';
@@ -52,7 +52,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {Node}
*/
this.labelActiveNode_ = goog.isString(labelActive) ?
goog.dom.createTextNode(labelActive) : labelActive;
document.createTextNode(labelActive) : labelActive;
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
var button = goog.dom.createDom('BUTTON', {

View File

@@ -17,7 +17,7 @@ goog.require('ol');
* @return {CanvasRenderingContext2D}
*/
ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
var canvas = goog.dom.createElement('CANVAS');
var canvas = document.createElement('CANVAS');
if (opt_width) {
canvas.width = opt_width;
}
@@ -44,7 +44,7 @@ ol.dom.canUseCssTransform = (function() {
// this browser is ancient
canUseCssTransform = false;
} else {
var el = goog.dom.createElement('P'),
var el = document.createElement('P'),
has2d,
transforms = {
'webkitTransform': '-webkit-transform',
@@ -87,7 +87,7 @@ ol.dom.canUseCssTransform3D = (function() {
// this browser is ancient
canUseCssTransform3D = false;
} else {
var el = goog.dom.createElement('P'),
var el = document.createElement('P'),
has3d,
transforms = {
'webkitTransform': '-webkit-transform',

View File

@@ -1,6 +1,5 @@
goog.provide('ol.has');
goog.require('goog.dom');
goog.require('ol');
goog.require('ol.dom');
goog.require('ol.webgl');
@@ -124,7 +123,7 @@ ol.has.WEBGL;
if ('WebGLRenderingContext' in goog.global) {
try {
var canvas = /** @type {HTMLCanvasElement} */
(goog.dom.createElement('CANVAS'));
(document.createElement('CANVAS'));
var gl = ol.webgl.getContext(canvas, {
failIfMajorPerformanceCaveat: true
});

View File

@@ -20,7 +20,7 @@ goog.require('ol.vec.Mat4');
* @param {ol.layer.Image} imageLayer Image layer.
*/
ol.renderer.dom.ImageLayer = function(imageLayer) {
var target = goog.dom.createElement('DIV');
var target = document.createElement('DIV');
target.style.position = 'absolute';
goog.base(this, imageLayer, target);

View File

@@ -61,7 +61,7 @@ ol.renderer.dom.Map = function(container, map) {
* @type {!Element}
* @private
*/
this.layersPane_ = goog.dom.createElement('DIV');
this.layersPane_ = document.createElement('DIV');
this.layersPane_.className = ol.css.CLASS_UNSELECTABLE;
var style = this.layersPane_.style;
style.position = 'absolute';

View File

@@ -31,7 +31,7 @@ goog.require('ol.vec.Mat4');
*/
ol.renderer.dom.TileLayer = function(tileLayer) {
var target = goog.dom.createElement('DIV');
var target = document.createElement('DIV');
target.style.position = 'absolute';
goog.base(this, tileLayer, target);
@@ -276,7 +276,7 @@ ol.renderer.dom.TileLayerZ_ = function(tileGrid, tileCoordOrigin) {
/**
* @type {!Element}
*/
this.target = goog.dom.createElement('DIV');
this.target = document.createElement('DIV');
this.target.style.position = 'absolute';
this.target.style.width = '100%';
this.target.style.height = '100%';
@@ -359,7 +359,7 @@ ol.renderer.dom.TileLayerZ_.prototype.addTile = function(tile, tileGutter) {
var tileElement;
var tileElementStyle;
if (tileGutter > 0) {
tileElement = goog.dom.createElement('DIV');
tileElement = document.createElement('DIV');
tileElementStyle = tileElement.style;
tileElementStyle.overflow = 'hidden';
tileElementStyle.width = tileSize[0] + 'px';

View File

@@ -58,7 +58,7 @@ ol.renderer.webgl.Map = function(container, map) {
* @type {HTMLCanvasElement}
*/
this.canvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement('CANVAS'));
(document.createElement('CANVAS'));
this.canvas_.style.width = '100%';
this.canvas_.style.height = '100%';
this.canvas_.className = ol.css.CLASS_UNSELECTABLE;

View File

@@ -2,7 +2,6 @@ goog.provide('ol.style.Atlas');
goog.provide('ol.style.AtlasManager');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.functions');
goog.require('goog.object');
goog.require('ol');
@@ -297,7 +296,7 @@ ol.style.Atlas = function(size, space) {
* @type {HTMLCanvasElement}
*/
this.canvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement('CANVAS'));
(document.createElement('CANVAS'));
this.canvas_.width = size;
this.canvas_.height = size;

View File

@@ -1,7 +1,6 @@
goog.provide('ol.style.Circle');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('ol');
goog.require('ol.color');
goog.require('ol.has');
@@ -272,7 +271,7 @@ ol.style.Circle.prototype.render_ = function(atlasManager) {
if (atlasManager === undefined) {
// no atlas manager is used, create a new canvas
this.canvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement('CANVAS'));
(document.createElement('CANVAS'));
this.canvas_.height = size;
this.canvas_.width = size;
@@ -373,7 +372,7 @@ ol.style.Circle.prototype.createHitDetectionCanvas_ = function(renderOptions) {
// if no fill style is set, create an extra hit-detection image with a
// default fill style
this.hitDetectionCanvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement('CANVAS'));
(document.createElement('CANVAS'));
var canvas = this.hitDetectionCanvas_;
canvas.height = renderOptions.size;

View File

@@ -1,7 +1,6 @@
goog.provide('ol.style.RegularShape');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('ol');
goog.require('ol.color');
goog.require('ol.has');
@@ -352,7 +351,7 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
if (atlasManager === undefined) {
// no atlas manager is used, create a new canvas
this.canvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement('CANVAS'));
(document.createElement('CANVAS'));
this.canvas_.height = size;
this.canvas_.width = size;
@@ -464,7 +463,7 @@ ol.style.RegularShape.prototype.createHitDetectionCanvas_ =
// if no fill style is set, create an extra hit-detection image with a
// default fill style
this.hitDetectionCanvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement('CANVAS'));
(document.createElement('CANVAS'));
var canvas = this.hitDetectionCanvas_;
canvas.height = renderOptions.size;