Remove goog.dom

This commit is contained in:
nicholas
2016-03-26 23:13:10 +13:00
committed by Nicholas L
parent 29c8af7559
commit 6b465902cd
37 changed files with 446 additions and 320 deletions
+32 -23
View File
@@ -1,7 +1,6 @@
goog.provide('ol.control.OverviewMap');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol');
@@ -17,6 +16,7 @@ goog.require('ol.ViewProperty');
goog.require('ol.control.Control');
goog.require('ol.coordinate');
goog.require('ol.css');
goog.require('ol.dom');
goog.require('ol.extent');
@@ -55,30 +55,37 @@ ol.control.OverviewMap = function(opt_options) {
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00AB';
/**
* @private
* @type {Node}
*/
this.collapseLabel_ = typeof collapseLabel === 'string' ?
goog.dom.createDom('SPAN', {}, collapseLabel) :
collapseLabel;
if (typeof collapseLabel === 'string') {
/**
* @private
* @type {Node}
*/
this.collapseLabel_ = document.createElement('span');
this.collapseLabel_.textContent = collapseLabel;
} else {
this.collapseLabel_ = collapseLabel;
}
var label = options.label !== undefined ? options.label : '\u00BB';
/**
* @private
* @type {Node}
*/
this.label_ = typeof label === 'string' ?
goog.dom.createDom('SPAN', {}, label) :
label;
if (typeof label === 'string') {
/**
* @private
* @type {Node}
*/
this.label_ = document.createElement('span');
this.label_.textContent = label;
} else {
this.label_ = label;
}
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
this.collapseLabel_ : this.label_;
var button = goog.dom.createDom('BUTTON', {
'type': 'button',
'title': tipLabel
}, activeLabel);
var button = document.createElement('button');
button.setAttribute('type', 'button');
button.title = tipLabel;
button.appendChild(activeLabel);
ol.events.listen(button, ol.events.EventType.CLICK,
this.handleClick_, this);
@@ -127,8 +134,10 @@ ol.control.OverviewMap = function(opt_options) {
ol.css.CLASS_CONTROL +
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
(this.collapsible_ ? '' : ' ol-uncollapsible');
var element = goog.dom.createDom('DIV',
cssClasses, ovmapDiv, button);
var element = document.createElement('div');
element.className = cssClasses;
element.appendChild(ovmapDiv);
element.appendChild(button);
var render = options.render ? options.render : ol.control.OverviewMap.render;
@@ -445,9 +454,9 @@ ol.control.OverviewMap.prototype.handleClick_ = function(event) {
ol.control.OverviewMap.prototype.handleToggle_ = function() {
this.element.classList.toggle('ol-collapsed');
if (this.collapsed_) {
goog.dom.replaceNode(this.collapseLabel_, this.label_);
ol.dom.replaceNode(this.collapseLabel_, this.label_);
} else {
goog.dom.replaceNode(this.label_, this.collapseLabel_);
ol.dom.replaceNode(this.label_, this.collapseLabel_);
}
this.collapsed_ = !this.collapsed_;