Skip to content

Commit

Permalink
All Examples: Add "use strict" and lint rule (pull #1416)
Browse files Browse the repository at this point in the history
* add strict mode and fix all errors
* fix linting errors
* Fix menubar
* Declare undeclared variables in tabs

Co-authored-by: Valerie Young <valerie@bocoup.com>
  • Loading branch information
smhigley and Valerie Young authored Jun 25, 2020
1 parent f2358c6 commit 2ddb55d
Show file tree
Hide file tree
Showing 88 changed files with 211 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"no-restricted-properties": [2, {
"property": "findElements",
"message": "Please use t.context.queryElements()."
}]
}],
"strict": [2, "global"]
}
}
3 changes: 3 additions & 0 deletions examples/alert/js/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*
*/

'use strict';

window.addEventListener('load', function () {

var button = document.getElementById('alert-trigger');
Expand Down
2 changes: 2 additions & 0 deletions examples/button/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* JS code for the button design pattern
*/

'use strict';

var ICON_MUTE_URL = 'images/mute.svg#icon-mute';
var ICON_SOUND_URL = 'images/mute.svg#icon-sound';

Expand Down
2 changes: 2 additions & 0 deletions examples/button/js/button_idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* JS code for the button design pattern using the new ARIA 1.2 IDL for reflection.
*/

'use strict';

var ICON_MUTE_URL = 'images/mute.svg#icon-mute';
var ICON_SOUND_URL = 'images/mute.svg#icon-sound';

Expand Down
2 changes: 2 additions & 0 deletions examples/carousel/js/carousel-tablist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*
*/

'use strict';

// takes options object: { accessibleCaptions: boolean, autoplay: boolean, playButton: boolean }
// defaults are: { accessibleCaptions: true, autoplay: false, playButton: true }

Expand Down
2 changes: 2 additions & 0 deletions examples/carousel/js/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*
*/

'use strict';

/*
* @constructor CarouselTablist
*
Expand Down
2 changes: 2 additions & 0 deletions examples/carousel/js/carouselButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Desc: Carousel Button widget that implements ARIA Authoring Practices
*/

'use strict';

/*
* @constructor CarouselButton
*
Expand Down
2 changes: 2 additions & 0 deletions examples/carousel/js/carouselItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Desc: Carousel Tab widget that implements ARIA Authoring Practices
*/

'use strict';

/*
* @constructor CarouselItem
*
Expand Down
2 changes: 2 additions & 0 deletions examples/carousel/js/pauseButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*
*/

'use strict';

var PauseButton = function (domNode, carouselObj) {
this.domNode = domNode;

Expand Down
2 changes: 2 additions & 0 deletions examples/checkbox/checkbox-1/js/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*
*/

'use strict';

/*
* @constructor Checkbox
*
Expand Down
2 changes: 2 additions & 0 deletions examples/checkbox/checkbox-2/js/checkboxMixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* for a menu of links
*/

'use strict';

/*
* @constructor CheckboxMixed
*
Expand Down
2 changes: 2 additions & 0 deletions examples/checkbox/checkbox-2/js/controlledCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* for a mixed checkbox
*/

'use strict';

/*
* @constructor ControlledCheckbox
*
Expand Down
3 changes: 3 additions & 0 deletions examples/combobox/js/combobox-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

var ComboboxAutocomplete = function (comboboxNode, buttonNode, listboxNode) {

this.comboboxNode = comboboxNode;
Expand Down
2 changes: 2 additions & 0 deletions examples/combobox/js/grid-combo-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* ARIA Combobox Examples
*/

'use strict';

var FRUITS_AND_VEGGIES = [
['Apple', 'Fruit'],
['Artichoke', 'Vegetable'],
Expand Down
2 changes: 2 additions & 0 deletions examples/combobox/js/grid-combo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* @constructor
*
Expand Down
2 changes: 2 additions & 0 deletions examples/dialog-modal/js/alertdialog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var aria = aria || {};

aria.Utils = aria.Utils || {};
Expand Down
2 changes: 2 additions & 0 deletions examples/dialog-modal/js/calendar-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* File: calendar-button.js
*/

'use strict';

var DatePicker = DatePicker || {};

var CalendarButtonInput = function (inputNode, buttonNode, datepicker) {
Expand Down
2 changes: 2 additions & 0 deletions examples/dialog-modal/js/datepicker-day.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* File: datepickerDay.js
*/

'use strict';

var DatePickerDay = function (domNode, datepicker, index, row, column) {

this.index = index;
Expand Down
2 changes: 2 additions & 0 deletions examples/dialog-modal/js/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* File: datepicker.js
*/

'use strict';

var CalendarButtonInput = CalendarButtonInput || {};
var DatePickerDay = DatePickerDay || {};

Expand Down
2 changes: 2 additions & 0 deletions examples/dialog-modal/js/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

var aria = aria || {};

aria.Utils = aria.Utils || {};
Expand Down
2 changes: 2 additions & 0 deletions examples/disclosure/js/disclosureButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* for a menu of links
*/

'use strict';

/*
* @constructor ButtonExpand
*
Expand Down
1 change: 1 addition & 0 deletions examples/disclosure/js/disclosureMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Supplemental JS for the disclosure menu keyboard behavior
*/

'use strict';

var DisclosureNav = function (domNode) {
this.rootNode = domNode;
Expand Down
2 changes: 2 additions & 0 deletions examples/feed/js/feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* @namespace aria
*/
Expand Down
2 changes: 2 additions & 0 deletions examples/feed/js/feedDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* @namespace aria
*/
Expand Down
2 changes: 2 additions & 0 deletions examples/feed/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* ARIA Feed Example
* @function onload
Expand Down
2 changes: 2 additions & 0 deletions examples/grid/js/dataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* @namespace aria
*/
Expand Down
3 changes: 3 additions & 0 deletions examples/grid/js/dataGrids.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* ARIA Grid Examples
* @function onload
Expand Down
3 changes: 3 additions & 0 deletions examples/grid/js/layoutGrids.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

var aria = aria || {};

/**
Expand Down
2 changes: 2 additions & 0 deletions examples/grid/js/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*
*/

'use strict';

/**
* ARIA Menu Button example
* @function onload
Expand Down
1 change: 1 addition & 0 deletions examples/js/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
(function () {
// Load syntax highlighting
hljs.initHighlightingOnLoad();
Expand Down
2 changes: 2 additions & 0 deletions examples/js/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* @namespace aria
*/

'use strict';

var aria = aria || {};

/* ---------------------------------------------------------------- */
Expand Down
1 change: 1 addition & 0 deletions examples/js/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
/**
* @namespace aria
*/
Expand Down
2 changes: 2 additions & 0 deletions examples/landmarks/js/bootstrap-accessibility-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

'use strict';

// Removes the "tablist" role from bootstrap.js "nav" class objects
$(document).ready(function (e) {
$('ul.nav-stacked').removeAttr('role');
Expand Down
2 changes: 2 additions & 0 deletions examples/landmarks/js/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

'use strict';

function showLandmarks (event) {
if (typeof window[initLandmarks] !== 'function') {
window[initLandmarks] = initLandmarks();
Expand Down
2 changes: 2 additions & 0 deletions examples/landmarks/js/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

'use strict';

$('#myTabs a').click(function (e) {
e.preventDefault();
$(this).tab('show');
Expand Down
3 changes: 3 additions & 0 deletions examples/link/js/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

function goToLink (event, url) {
var type = event.type;

Expand Down
1 change: 1 addition & 0 deletions examples/listbox/js/listbox-collapsible.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
/**
* ARIA Collapsible Dropdown Listbox Example
* @function onload
Expand Down
3 changes: 3 additions & 0 deletions examples/listbox/js/listbox-rearrangeable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* ARIA Listbox Examples
* @function onload
Expand Down
3 changes: 3 additions & 0 deletions examples/listbox/js/listbox-scrollable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* ARIA Scrollable Listbox Example
* @function onload
Expand Down
3 changes: 3 additions & 0 deletions examples/listbox/js/listbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* @namespace aria
*/
Expand Down
3 changes: 3 additions & 0 deletions examples/listbox/js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*/

'use strict';

/**
* @namespace aria
*/
Expand Down
2 changes: 2 additions & 0 deletions examples/menu-button/js/MenuItemAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Desc: Popup Menu Menuitem widget that implements ARIA Authoring Practices
*/

'use strict';

/*
* @constructor MenuItem
*
Expand Down
2 changes: 2 additions & 0 deletions examples/menu-button/js/MenuItemActionActivedescendant.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Desc: Popup Menu Menuitem widget that implements ARIA Authoring Practices
*/

'use strict';

/*
* @constructor MenuItem
*
Expand Down
2 changes: 2 additions & 0 deletions examples/menu-button/js/MenuItemLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Desc: Popup Menu Menuitem widget that implements ARIA Authoring Practices
*/

'use strict';

/*
* @constructor MenuItemLinks
*
Expand Down
2 changes: 2 additions & 0 deletions examples/menu-button/js/Menubutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Desc: Menubutton widget that implements ARIA Authoring Practices
*/

'use strict';

/*
* @constructor MenuButton
*
Expand Down
Loading

0 comments on commit 2ddb55d

Please sign in to comment.