Permalink
Browse files

Set type="text" for the <input> element in goog.ui.ComboBox.

My use case is to be able to easily customize the style of all text inputs without modifying other input controls such as radio buttons. If the text attribute is not set, the CSS styles set in input[type=text] selectors are not applied.

R=chrishenry,nnaze
DELTA=12 (11 added, 0 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6114


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2430 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent 25b0b5c commit bf80bcd3f6614f76bb0f50fbd1aaa74c48a5f419 pallosp@google.com committed Jan 10, 2013
Showing with 12 additions and 1 deletion.
  1. +1 −1 closure/goog/ui/combobox.js
  2. +11 −0 closure/goog/ui/combobox_test.html
@@ -200,7 +200,7 @@ goog.ui.ComboBox.prototype.useDropdownArrow_ = false;
*/
goog.ui.ComboBox.prototype.createDom = function() {
this.input_ = this.getDomHelper().createDom(
- 'input', {'name': this.fieldName_, 'autocomplete': 'off'});
+ 'input', {name: this.fieldName_, type: 'text', autocomplete: 'off'});
this.button_ = this.getDomHelper().createDom('span',
goog.getCssName('goog-combobox-button'));
this.setElementInternal(this.getDomHelper().createDom('span',
@@ -76,6 +76,17 @@ <h2 style="color:red">
goog.events.removeAll();
}
+function testInputElementAttributes() {
+ var comboBox = new goog.ui.ComboBox();
+ comboBox.setFieldName('a_form_field');
+ comboBox.createDom();
+ var inputElement = comboBox.getInputElement();
+ assertEquals('text', inputElement.type);
+ assertEquals('a_form_field', inputElement.name);
+ assertEquals('off', inputElement.autocomplete);
+ comboBox.dispose();
+}
+
function testSetDefaultText() {
assertEquals('Select a color...', comboBox.getDefaultText());
comboBox.setDefaultText('new default text...');

0 comments on commit bf80bcd

Please sign in to comment.