Permalink
Browse files

Redirect all usages of goog.dom.a11y to goog.a11y.aria.

The changes are made by applying replace_string transformations, so
please double check the replacements.

R=chrishenry,nnaze,ruilopes
DELTA=829 (276 added, 65 deleted, 488 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6196


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2466 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent 135459e commit dc31915961ba58240618e25b1799560b8a667024 atincheva@google.com committed Jan 24, 2013
Showing with 623 additions and 457 deletions.
  1. +39 −39 closure/goog/deps.js
  2. +4 −3 closure/goog/ui/abstractspellchecker.js
  3. +8 −6 closure/goog/ui/ac/autocomplete_test.html
  4. +4 −2 closure/goog/ui/ac/inputhandler.js
  5. +18 −10 closure/goog/ui/ac/renderer.js
  6. +21 −12 closure/goog/ui/ac/renderer_test.html
  7. +8 −6 closure/goog/ui/animatedzippy_test.html
  8. +6 −7 closure/goog/ui/attachablemenu.js
  9. +9 −6 closure/goog/ui/buttonrenderer.js
  10. +11 −10 closure/goog/ui/buttonrenderer_test.html
  11. +4 −1 closure/goog/ui/charpicker.js
  12. +9 −4 closure/goog/ui/checkbox.js
  13. +28 −28 closure/goog/ui/checkbox_test.html
  14. +10 −10 closure/goog/ui/checkboxrenderer.js
  15. +15 −6 closure/goog/ui/container.js
  16. +4 −3 closure/goog/ui/containerrenderer.js
  17. +3 −3 closure/goog/ui/control.js
  18. +12 −10 closure/goog/ui/controlrenderer.js
  19. +72 −61 closure/goog/ui/controlrenderer_test.html
  20. +3 −2 closure/goog/ui/custombuttonrenderer.js
  21. +9 −5 closure/goog/ui/datepicker.js
  22. +3 −2 closure/goog/ui/datepicker_test.html
  23. +26 −19 closure/goog/ui/dialog.js
  24. +21 −11 closure/goog/ui/dialog_test.html
  25. +2 −2 closure/goog/ui/emoji/emojipaletterenderer.js
  26. +4 −2 closure/goog/ui/flatbuttonrenderer.js
  27. +17 −13 closure/goog/ui/gauge.js
  28. +19 −12 closure/goog/ui/labelinput.js
  29. +10 −8 closure/goog/ui/labelinput_test.html
  30. +2 −4 closure/goog/ui/menubarrenderer.js
  31. +21 −11 closure/goog/ui/menubutton.js
  32. +7 −4 closure/goog/ui/menubutton_test.html
  33. +9 −7 closure/goog/ui/menuitemrenderer.js
  34. +7 −4 closure/goog/ui/menuitemrenderer_test.html
  35. +7 −5 closure/goog/ui/menurenderer.js
  36. +5 −5 closure/goog/ui/paletterenderer.js
  37. +6 −3 closure/goog/ui/plaintextspellchecker.js
  38. +19 −6 closure/goog/ui/progressbar.js
  39. +14 −7 closure/goog/ui/ratings.js
  40. +11 −7 closure/goog/ui/select.js
  41. +15 −12 closure/goog/ui/select_test.html
  42. +6 −2 closure/goog/ui/separator.js
  43. +3 −3 closure/goog/ui/slider.js
  44. +14 −13 closure/goog/ui/sliderbase.js
  45. +5 −5 closure/goog/ui/sliderbase_test.html
  46. +3 −3 closure/goog/ui/style/app/menubuttonrenderer.js
  47. +8 −3 closure/goog/ui/submenurenderer.js
  48. +3 −3 closure/goog/ui/tabbarrenderer.js
  49. +2 −2 closure/goog/ui/tabbarrenderer_test.html
  50. +3 −3 closure/goog/ui/tabrenderer.js
  51. +2 −2 closure/goog/ui/tabrenderer_test.html
  52. +2 −2 closure/goog/ui/toolbarrenderer.js
  53. +28 −21 closure/goog/ui/tree/basenode.js
  54. +5 −3 closure/goog/ui/tree/treecontrol.js
  55. +3 −3 closure/goog/ui/twothumbslider.js
  56. +8 −6 closure/goog/ui/zippy.js
  57. +6 −5 closure/goog/ui/zippy_test.html
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -38,6 +38,7 @@
goog.provide('goog.ui.AbstractSpellChecker');
goog.provide('goog.ui.AbstractSpellChecker.AsyncResult');
+goog.require('goog.a11y.aria');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.dom.classes');
@@ -750,10 +751,10 @@ goog.ui.AbstractSpellChecker.prototype.createWordElement_ = function(word,
parameters['tabIndex'] = -1;
}
- var el = /** @type {HTMLSpanElement} */
+ var el = /** @type {!HTMLSpanElement} */
(this.getDomHelper().createDom('span', parameters, word));
- goog.dom.a11y.setRole(el, 'menuitem');
- goog.dom.a11y.setState(el, 'haspopup', true);
+ goog.a11y.aria.setRole(el, 'menuitem');
+ goog.a11y.aria.setState(el, 'haspopup', true);
this.registerWordElement_(word, el);
return el;
@@ -14,9 +14,9 @@
<script src="../../base.js"></script>
<script>
goog.require('goog.dom');
- goog.require('goog.dom.a11y');
- goog.require('goog.dom.a11y.Role');
- goog.require('goog.dom.a11y.State');
+ goog.require('goog.a11y.aria');
+ goog.require('goog.a11y.aria.Role');
+ goog.require('goog.a11y.aria.State');
goog.require('goog.events.EventHandler');
goog.require('goog.events.EventTarget');
goog.require('goog.string');
@@ -707,12 +707,14 @@
*/
function testRolesAndStates() {
function checkActiveDescendant(activeDescendant) {
+ assertNotNull(inputElement);
assertEquals(
- goog.dom.a11y.getActiveDescendant(inputElement),
+ goog.a11y.aria.getActiveDescendant(inputElement),
activeDescendant);
}
function checkRole(el, role) {
- assertEquals(goog.dom.a11y.getRole(el), role);
+ assertNotNull(el);
+ assertEquals(goog.a11y.aria.getRole(el), role);
}
var ds = new MockDS();
var rend = new TestRend();
@@ -730,7 +732,7 @@
checkActiveDescendant(rend.getHilitedRowDiv());
// highligted row should have a role of 'option'
- checkRole(rend.getHilitedRowDiv(), goog.dom.a11y.Role.OPTION);
+ checkRole(rend.getHilitedRowDiv(), goog.a11y.aria.Role.OPTION);
// closing the autocomplete should clear activedescendant
ac.dismiss();
@@ -93,8 +93,9 @@ goog.provide('goog.ui.ac.InputHandler');
goog.require('goog.Disposable');
goog.require('goog.Timer');
+goog.require('goog.a11y.aria');
+goog.require('goog.asserts');
goog.require('goog.dom');
-goog.require('goog.dom.a11y');
goog.require('goog.dom.selection');
goog.require('goog.events.EventHandler');
goog.require('goog.events.EventType');
@@ -442,7 +443,8 @@ goog.ui.ac.InputHandler.prototype.setCursorPosition = function(pos) {
*/
goog.ui.ac.InputHandler.prototype.attachInput = function(target) {
if (goog.dom.isElement(target)) {
- goog.dom.a11y.setState(/** @type {Element} */ (target), 'haspopup', true);
+ var el = /** @type {!Element} */ (target);
+ goog.a11y.aria.setState(el, 'haspopup', true);
}
this.eh_.listen(target, goog.events.EventType.FOCUS, this.handleFocus);
@@ -21,9 +21,11 @@
goog.provide('goog.ui.ac.Renderer');
goog.provide('goog.ui.ac.Renderer.CustomRenderer');
+goog.require('goog.a11y.aria');
+goog.require('goog.a11y.aria.Role');
+goog.require('goog.a11y.aria.State');
goog.require('goog.dispose');
goog.require('goog.dom');
-goog.require('goog.dom.a11y');
goog.require('goog.dom.classes');
goog.require('goog.events.Event');
goog.require('goog.events.EventTarget');
@@ -402,14 +404,16 @@ goog.ui.ac.Renderer.prototype.renderRows = function(rows, token, opt_target) {
*/
goog.ui.ac.Renderer.prototype.dismiss = function() {
if (this.target_) {
- goog.dom.a11y.setActiveDescendant(this.target_, null);
+ goog.a11y.aria.setActiveDescendant(this.target_, null);
}
if (this.visible_) {
this.visible_ = false;
// Clear ARIA popup role for the target input box.
if (this.target_) {
- goog.dom.a11y.setState(this.target_, goog.dom.a11y.State.HASPOPUP, false);
+ goog.a11y.aria.setState(this.target_,
+ goog.a11y.aria.State.HASPOPUP,
+ false);
}
if (this.menuFadeDuration_ > 0) {
@@ -433,10 +437,14 @@ goog.ui.ac.Renderer.prototype.show = function() {
// Set ARIA roles and states for the target input box.
if (this.target_) {
- goog.dom.a11y.setRole(this.target_, goog.dom.a11y.Role.COMBOBOX);
- goog.dom.a11y.setState(
- this.target_, goog.dom.a11y.State.AUTOCOMPLETE, 'list');
- goog.dom.a11y.setState(this.target_, goog.dom.a11y.State.HASPOPUP, true);
+ goog.a11y.aria.setRole(this.target_,
+ goog.a11y.aria.Role.COMBOBOX);
+ goog.a11y.aria.setState(this.target_,
+ goog.a11y.aria.State.AUTOCOMPLETE,
+ 'list');
+ goog.a11y.aria.setState(this.target_,
+ goog.a11y.aria.State.HASPOPUP,
+ true);
}
if (this.menuFadeDuration_ > 0) {
@@ -476,7 +484,7 @@ goog.ui.ac.Renderer.prototype.hiliteRow = function(index) {
goog.dom.classes.add(rowDiv, this.activeClassName,
this.legacyActiveClassName_);
if (this.target_) {
- goog.dom.a11y.setActiveDescendant(this.target_, rowDiv);
+ goog.a11y.aria.setActiveDescendant(this.target_, rowDiv);
}
goog.style.scrollIntoContainerView(rowDiv, this.element_);
}
@@ -536,7 +544,7 @@ goog.ui.ac.Renderer.prototype.maybeCreateElement_ = function() {
var el = this.dom_.createDom('div', {style: 'display:none'});
this.element_ = el;
this.setMenuClasses_(el);
- goog.dom.a11y.setRole(el, goog.dom.a11y.Role.LISTBOX);
+ goog.a11y.aria.setRole(el, goog.a11y.aria.Role.LISTBOX);
el.id = goog.ui.IdGenerator.getInstance().getNextUniqueId();
@@ -890,7 +898,7 @@ goog.ui.ac.Renderer.prototype.renderRowHtml = function(row, token) {
className: this.rowClassName,
id: goog.ui.IdGenerator.getInstance().getNextUniqueId()
});
- goog.dom.a11y.setRole(node, goog.dom.a11y.Role.OPTION);
+ goog.a11y.aria.setRole(node, goog.a11y.aria.Role.OPTION);
if (this.customRenderer_ && this.customRenderer_.renderRow) {
this.customRenderer_.renderRow(row, token, node);
} else {
@@ -14,9 +14,9 @@
<script src="../../base.js"></script>
<script>
goog.require('goog.dom');
- goog.require('goog.dom.a11y');
- goog.require('goog.dom.a11y.Role');
- goog.require('goog.dom.a11y.State');
+ goog.require('goog.a11y.aria');
+ goog.require('goog.a11y.aria.Role');
+ goog.require('goog.a11y.aria.State');
goog.require('goog.events');
goog.require('goog.functions');
goog.require('goog.fx.dom.FadeInAndShow');
@@ -470,25 +470,34 @@
function testAriaTags() {
renderer.maybeCreateElement_();
- assertEquals('', goog.dom.a11y.getRole(target));
+ assertNotNull(target);
+ assertEquals('', goog.a11y.aria.getRole(target));
assertEquals('',
- goog.dom.a11y.getState(target, goog.dom.a11y.State.AUTOCOMPLETE));
+ goog.a11y.aria.getState(target,
+ goog.a11y.aria.State.AUTOCOMPLETE));
assertEquals('',
- goog.dom.a11y.getState(target, goog.dom.a11y.State.HASPOPUP));
+ goog.a11y.aria.getState(target,
+ goog.a11y.aria.State.HASPOPUP));
renderer.show();
- assertEquals(goog.dom.a11y.Role.COMBOBOX, goog.dom.a11y.getRole(target));
+ assertEquals(goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.getRole(
+ target));
assertEquals('list',
- goog.dom.a11y.getState(target, goog.dom.a11y.State.AUTOCOMPLETE));
+ goog.a11y.aria.getState(target,
+ goog.a11y.aria.State.AUTOCOMPLETE));
assertEquals('true',
- goog.dom.a11y.getState(target, goog.dom.a11y.State.HASPOPUP));
+ goog.a11y.aria.getState(target,
+ goog.a11y.aria.State.HASPOPUP));
renderer.dismiss();
- assertEquals(goog.dom.a11y.Role.COMBOBOX, goog.dom.a11y.getRole(target));
+ assertEquals(goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.getRole(
+ target));
assertEquals('list',
- goog.dom.a11y.getState(target, goog.dom.a11y.State.AUTOCOMPLETE));
+ goog.a11y.aria.getState(target,
+ goog.a11y.aria.State.AUTOCOMPLETE));
assertEquals('false',
- goog.dom.a11y.getState(target, goog.dom.a11y.State.HASPOPUP));
+ goog.a11y.aria.getState(target,
+ goog.a11y.aria.State.HASPOPUP));
}
function testHiliteRowWithDefaultRenderer() {
@@ -13,9 +13,10 @@
<title>Closure Unit Tests - goog.ui.AnimatedZippy</title>
<script src="../base.js"></script>
<script>
+ goog.require('goog.asserts');
+ goog.require('goog.a11y.aria');
+ goog.require('goog.a11y.aria.State');
goog.require('goog.dom');
- goog.require('goog.dom.a11y');
- goog.require('goog.dom.a11y.State');
goog.require('goog.events');
goog.require('goog.functions');
goog.require('goog.fx.Animation');
@@ -75,6 +76,7 @@ <h2 id="t1">handler</h2>
function setUp() {
animatedZippyHeaderEl = goog.dom.getElement('t1');
+ goog.asserts.assert(animatedZippyHeaderEl);
animatedZippy = new goog.ui.AnimatedZippy(animatedZippyHeaderEl,
goog.dom.getElement('c1'));
@@ -108,8 +110,8 @@ <h2 id="t1">handler</h2>
assertEquals('expanded must be true', true,
animatedZippy.isExpanded());
assertEquals('aria-expanded must be true', 'true',
- goog.dom.a11y.getState(animatedZippyHeaderEl,
- goog.dom.a11y.State.EXPANDED));
+ goog.a11y.aria.getState(animatedZippyHeaderEl,
+ goog.a11y.aria.State.EXPANDED));
});
animatedZippy.expand();
@@ -121,8 +123,8 @@ <h2 id="t1">handler</h2>
assertEquals('expanded must be false', false,
animatedZippy.isExpanded());
assertEquals('aria-expanded must be false', 'false',
- goog.dom.a11y.getState(animatedZippyHeaderEl,
- goog.dom.a11y.State.EXPANDED));
+ goog.a11y.aria.getState(animatedZippyHeaderEl,
+ goog.a11y.aria.State.EXPANDED));
});
animatedZippy.collapse();
@@ -19,8 +19,9 @@
goog.provide('goog.ui.AttachableMenu');
-goog.require('goog.dom.a11y');
-goog.require('goog.dom.a11y.State');
+goog.require('goog.a11y.aria');
+goog.require('goog.a11y.aria.State');
+goog.require('goog.asserts');
goog.require('goog.events.KeyCodes');
goog.require('goog.ui.ItemEvent');
goog.require('goog.ui.MenuBase');
@@ -152,15 +153,15 @@ goog.ui.AttachableMenu.prototype.setSelectedItem = function(obj) {
this.selectedElement_ = elt;
var el = this.getElement();
+ goog.asserts.assert(el, 'The attachable menu DOM element cannot be null.');
if (this.selectedElement_) {
goog.dom.classes.add(this.selectedElement_, this.selectedItemClassName_);
if (elt.id) {
// Update activedescendant to reflect the new selection. ARIA roles for
// menu and menuitem can be set statically (thru Soy templates, for
// example) whereas this needs to be updated as the selection changes.
- goog.dom.a11y.setState(el,
- goog.dom.a11y.State.ACTIVEDESCENDANT,
+ goog.a11y.aria.setState(el, goog.a11y.aria.State.ACTIVEDESCENDANT,
elt.id);
}
@@ -178,9 +179,7 @@ goog.ui.AttachableMenu.prototype.setSelectedItem = function(obj) {
}
} else {
// Clear off activedescendant to reflect no selection.
- goog.dom.a11y.setState(el,
- goog.dom.a11y.State.ACTIVEDESCENDANT,
- '');
+ goog.a11y.aria.setState(el, goog.a11y.aria.State.ACTIVEDESCENDANT, '');
}
};
@@ -20,9 +20,10 @@
goog.provide('goog.ui.ButtonRenderer');
-goog.require('goog.dom.a11y');
-goog.require('goog.dom.a11y.Role');
-goog.require('goog.dom.a11y.State');
+goog.require('goog.a11y.aria');
+goog.require('goog.a11y.aria.Role');
+goog.require('goog.a11y.aria.State');
+goog.require('goog.asserts');
goog.require('goog.ui.ButtonSide');
goog.require('goog.ui.Component.State');
goog.require('goog.ui.ControlRenderer');
@@ -62,11 +63,11 @@ goog.ui.ButtonRenderer.CSS_CLASS = goog.getCssName('goog-button');
/**
* Returns the ARIA role to be applied to buttons.
- * @return {goog.dom.a11y.Role|undefined} ARIA role.
+ * @return {goog.a11y.aria.Role|undefined} ARIA role.
* @override
*/
goog.ui.ButtonRenderer.prototype.getAriaRole = function() {
- return goog.dom.a11y.Role.BUTTON;
+ return goog.a11y.aria.Role.BUTTON;
};
@@ -84,7 +85,9 @@ goog.ui.ButtonRenderer.prototype.updateAriaState = function(element, state,
enable) {
// If button has CHECKED state, assign ARIA atrribute aria-pressed
if (state == goog.ui.Component.State.CHECKED) {
- goog.dom.a11y.setState(element, goog.dom.a11y.State.PRESSED, enable);
+ goog.asserts.assert(element,
+ 'The button DOM element cannot be null.');
+ goog.a11y.aria.setState(element, goog.a11y.aria.State.PRESSED, enable);
} else {
goog.ui.ButtonRenderer.superClass_.updateAriaState.call(this, element,
state, enable);
Oops, something went wrong.

0 comments on commit dc31915

Please sign in to comment.