Permalink
Browse files

Automated g4 rollback.

*** Reason for rollback ***

May have broken default labels on IE8-.

*** Original change description ***

Change LabelInput to use goog.dom.classlist instead of goog.dom.classes.

This CL is testing the waters to see how painful migrating Closure from classes to classlist will be.

R=arv
DELTA=17  (0 added, 1 deleted, 16 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=5781


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2281 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent f49c45e commit f0541c2362a3301e8d73f3017e426404d3649e6d jeffschiller@google.com committed Nov 8, 2012
Showing with 15 additions and 15 deletions.
  1. +2 −2 closure/goog/deps.js
  2. +6 −6 closure/goog/ui/labelinput.js
  3. +7 −7 closure/goog/ui/labelinput_test.html
@@ -42,7 +42,7 @@ goog.require('goog.Timer');
goog.require('goog.dom');
goog.require('goog.dom.a11y');
goog.require('goog.dom.a11y.State');
-goog.require('goog.dom.classlist');
+goog.require('goog.dom.classes');
goog.require('goog.events.EventHandler');
goog.require('goog.events.EventType');
goog.require('goog.ui.Component');
@@ -130,7 +130,7 @@ goog.ui.LabelInput.prototype.decorateInternal = function(element) {
if (goog.dom.getActiveElement(goog.dom.getOwnerDocument(element)) ==
element) {
this.hasFocus_ = true;
- goog.dom.classlist.remove(this.getElement(), this.LABEL_CLASS_NAME);
+ goog.dom.classes.remove(this.getElement(), this.LABEL_CLASS_NAME);
}
if (goog.ui.LabelInput.SUPPORTS_PLACEHOLDER_) {
@@ -247,7 +247,7 @@ goog.ui.LabelInput.prototype.LABEL_CLASS_NAME =
*/
goog.ui.LabelInput.prototype.handleFocus_ = function(e) {
this.hasFocus_ = true;
- goog.dom.classlist.remove(this.getElement(), this.LABEL_CLASS_NAME);
+ goog.dom.classes.remove(this.getElement(), this.LABEL_CLASS_NAME);
if (goog.ui.LabelInput.SUPPORTS_PLACEHOLDER_) {
return;
}
@@ -475,15 +475,15 @@ goog.ui.LabelInput.prototype.check_ = function() {
if (!this.hasChanged()) {
if (!this.inFocusAndSelect_ && !this.hasFocus_) {
- goog.dom.classlist.add(this.getElement(), this.LABEL_CLASS_NAME);
+ goog.dom.classes.add(this.getElement(), this.LABEL_CLASS_NAME);
}
// Allow browser to catchup with CSS changes before restoring the label.
if (!goog.ui.LabelInput.SUPPORTS_PLACEHOLDER_) {
goog.Timer.callOnce(this.restoreLabel_, 10, this);
}
} else {
- goog.dom.classlist.remove(this.getElement(), this.LABEL_CLASS_NAME);
+ goog.dom.classes.remove(this.getElement(), this.LABEL_CLASS_NAME);
}
};
@@ -527,7 +527,7 @@ goog.ui.LabelInput.prototype.focusAndSelect = function() {
*/
goog.ui.LabelInput.prototype.setEnabled = function(enabled) {
this.getElement().disabled = !enabled;
- goog.dom.classlist.enable(this.getElement(),
+ goog.dom.classes.enable(this.getElement(),
goog.getCssName(this.LABEL_CLASS_NAME, 'disabled'), !enabled);
};
@@ -14,7 +14,7 @@
goog.require('goog.dom');
goog.require('goog.dom.a11y');
goog.require('goog.dom.a11y.State');
- goog.require('goog.dom.classlist');
+ goog.require('goog.dom.classes');
goog.require('goog.events.EventType');
goog.require('goog.testing.MockClock');
goog.require('goog.testing.events');
@@ -166,17 +166,17 @@
var el = labelInput.getElement();
assertTrue('label before focus should have LABEL_CLASS_NAME',
- goog.dom.classlist.contains(el, labelInput.LABEL_CLASS_NAME));
+ goog.dom.classes.has(el, labelInput.LABEL_CLASS_NAME));
labelInput.getElement().focus();
assertFalse('label after focus should not have LABEL_CLASS_NAME',
- goog.dom.classlist.contains(el, labelInput.LABEL_CLASS_NAME));
+ goog.dom.classes.has(el, labelInput.LABEL_CLASS_NAME));
labelInput.getElement().blur();
assertTrue('label after blur should have LABEL_CLASS_NAME',
- goog.dom.classlist.contains(el, labelInput.LABEL_CLASS_NAME));
+ goog.dom.classes.has(el, labelInput.LABEL_CLASS_NAME));
}
function isPlaceholderSupported() {
@@ -195,17 +195,17 @@
assertTrue('label should be enabled', labelInput.isEnabled());
assertFalse('label should not have the disabled class',
- goog.dom.classlist.contains(labelElement, disabledClass));
+ goog.dom.classes.has(labelElement, disabledClass));
labelInput.setEnabled(false);
assertFalse('label should be disabled', labelInput.isEnabled());
assertTrue('label should have the disabled class',
- goog.dom.classlist.contains(labelElement, disabledClass));
+ goog.dom.classes.has(labelElement, disabledClass));
labelInput.setEnabled(true);
assertTrue('label should be enabled', labelInput.isEnabled());
assertFalse('label should not have the disabled class',
- goog.dom.classlist.contains(labelElement, disabledClass));
+ goog.dom.classes.has(labelElement, disabledClass));
}
</script>

0 comments on commit f0541c2

Please sign in to comment.