'use strict';

goog.provide('Blockly.XButton');

/**
 * A DOM-based input which sends events on changes
 * @param {!Object} options
 * @param options.onNameChanged takes {string} newName
 * @param options.onEnterPressed
 * @constructor
 */
Blockly.XButton = function (options) {
  this.onButtonPressed = options.onButtonPressed;

  // For disposal
  this.eventsToUnbind_ = [];
  this.buttonElement_ = null;
};

Blockly.XButton.prototype.render = function (parent) {
  var buttonElement = goog.dom.createDom('button');
  buttonElement.className = "btn";
  buttonElement.innerHTML = "x";
  buttonElement.style.marginRight = "-10px";

  parent.appendChild(buttonElement);

  this.eventsToUnbind_.push(Blockly.bindEvent_(buttonElement, 'mousedown', this, goog.bind(function () {
    if (this.onButtonPressed) {
      this.onButtonPressed();
    }
  }, this)));

  this.buttonElement_ = buttonElement;
};

Blockly.XButton.prototype.dispose = function () {
  this.eventsToUnbind_.forEach(function(eventHandle) {
    Blockly.unbindEvent_(eventHandle);
  });
  goog.array.clear(this.eventsToUnbind_);

  goog.dom.removeNode(this.buttonElement_);
};

@@ -55,22 +55,38 @@
 * A 
-DOM-based inpu
+simple button with an %22x%22 on i
 t wh
@@ -99,25 +99,81 @@
 nds 
+an 
 event
-s
  on 
-changes
+press%0A *%0A * Note: styling depends on bootstrap 'btn' class%0A *
 %0A * 
@@ -695,16 +695,47 @@
 %22-10px%22;
+ // specific to contract editor
 %0A%0A  pare

Clarify x button class