From 114136834e5de1a452d2b6845787db89ce15e91d Mon Sep 17 00:00:00 2001 From: Bill Keese Date: Tue, 10 Mar 2020 08:50:34 +0900 Subject: [PATCH] Leverage native (or polyfilled) Promise, Element#classList, and Element#matches. Refs ibm-js/delite#520. --- .jshintrc | 2 +- Accordion.js | 22 +- DatePicker/DayPicker.js | 12 +- DatePicker/MonthPicker.js | 8 +- Gruntfile.js | 2 +- Panel.js | 2 +- ProgressBar.js | 7 +- ResponsiveColumns.js | 3 +- Select.js | 7 +- SidePane.js | 35 +- StarRating.js | 7 +- Switch.js | 15 +- ToasterMessage.js | 8 +- ViewStack.js | 20 +- intern.json | 4 + list/List.js | 17 +- list/List/nls/Pageable.js | 2 +- list/Loader.js | 2 +- list/PageableList.js | 3 +- tests/boilerplate.js | 54 +- tests/boilerplateOnload.js | 4 - tests/functional/DatePicker.html | 10 +- tests/functional/SidePane.html | 12 +- tests/ie-polyfills.js | 2430 ++++++++++++++++++++ tests/unit/Accordion.js | 1 - tests/unit/all.js | 36 - tests/unit/list/resources/ListBaseTests.js | 1 - 27 files changed, 2528 insertions(+), 198 deletions(-) delete mode 100644 tests/boilerplateOnload.js create mode 100644 tests/ie-polyfills.js delete mode 100644 tests/unit/all.js diff --git a/.jshintrc b/.jshintrc index da45b3559e..ef0b0c2246 100644 --- a/.jshintrc +++ b/.jshintrc @@ -66,7 +66,7 @@ "maxlen": 120, "indent": 4, "maxerr": 250, - "predef": [ "require", "requirejs", "define", "Intl", "intern" ], + "predef": [ "require", "requirejs", "define", "Intl", "intern", "Promise" ], "quotmark": "double", "maxcomplexity": 10 } diff --git a/Accordion.js b/Accordion.js index f75ffb3a4d..d463371849 100644 --- a/Accordion.js +++ b/Accordion.js @@ -2,14 +2,12 @@ define([ "dcl/dcl", "ibm-decor/sniff", - "requirejs-dplugins/Promise!", "delite/register", - "delite/classList", "delite/DisplayContainer", "./Accordion/AccordionHeader", "./features", "requirejs-dplugins/css!./Accordion/Accordion.css" -], function (dcl, has, Promise, register, classList, DisplayContainer, AccordionHeader) { +], function (dcl, has, register, DisplayContainer, AccordionHeader) { function setVisibility(node, val) { node.style.display = val ? "" : "none"; @@ -331,32 +329,34 @@ define([ if (params.hide) { if (this._useAnimation()) { // To avoid hiding the panel title bar on animation - classList.addClass(panel, "d-accordion-close-animation"); - classList.removeClass(panel, "d-accordion-open-panel"); + panel.classList.add("d-accordion-close-animation"); + panel.classList.remove("d-accordion-open-panel"); panel.style.overflow = "hidden"; //To avoid scrollBar on animation promise = listenAnimationEndEvent(panel).then(function () { setVisibility(panel, panel.open); - classList.removeClass(panel, "d-accordion-close-animation"); + panel.classList.remove("d-accordion-close-animation"); panel.style.overflow = ""; }); } else { - classList.removeClass(panel, "d-accordion-open-panel"); + panel.classList.remove("d-accordion-open-panel"); setVisibility(panel, false); } } else { if (this._useAnimation()) { - classList.addClass(panel, "d-accordion-open-animation"); + panel.classList.add("d-accordion-open-animation"); setVisibility(panel, true); panel.style.overflow = "hidden"; //To avoid scrollBar on animation promise = listenAnimationEndEvent(panel).then(function () { - classList.addClass(panel, panel.open ? "d-accordion-open-panel" : ""); - classList.removeClass(panel, "d-accordion-open-animation"); + if (panel.open) { + panel.classList.add("d-accordion-open-panel"); + } + panel.classList.remove("d-accordion-open-animation"); panel.style.overflow = ""; panel.style.minHeight = ""; }); } else { - classList.addClass(panel, "d-accordion-open-panel"); + panel.classList.add("d-accordion-open-panel"); setVisibility(panel, true); } } diff --git a/DatePicker/DayPicker.js b/DatePicker/DayPicker.js index 69b5539dd7..0b3440cdcc 100644 --- a/DatePicker/DayPicker.js +++ b/DatePicker/DayPicker.js @@ -2,7 +2,6 @@ define([ "dojo/i18n", "dcl/dcl", "delite/register", - "delite/classList", "delite/KeyNav", "../TimeBase", "delite/handlebars!./DayPicker.html" @@ -10,7 +9,6 @@ define([ i18n, dcl, register, - classList, KeyNav, TimeBase, template @@ -250,12 +248,12 @@ define([ var today = this.grid.querySelector(".d-date-picker-today"); if (today) { - classList.removeClass(today, "d-date-picker-today"); + today.classList.remove("d-date-picker-today"); } var todayCell = this._dateToCell(new this.dateClassObj()); if (todayCell) { - classList.addClass(todayCell, "d-date-picker-today"); + todayCell.classList.add("d-date-picker-today"); } } @@ -268,13 +266,13 @@ define([ if ("value" in oldVals || "dates" in oldVals) { var selected = this.grid.querySelector(".d-date-picker-selected"); if (selected) { - classList.removeClass(selected, "d-date-picker-selected"); + selected.classList.remove("d-date-picker-selected"); } if (this.value && !isNaN(this.value)) { var selectedCell = this._dateToCell(this.value); if (selectedCell) { - classList.addClass(selectedCell, "d-date-picker-selected"); + selectedCell.classList.add("d-date-picker-selected"); } } } @@ -317,7 +315,7 @@ define([ * @param {Date} date - The date displayed by this cell. */ styleGridCell: function (node, date) { - classList.toggleClass(node, "d-date-picker-other-month", date.getMonth() !== this.currentFocus.getMonth()); + node.classList.toggle("d-date-picker-other-month", date.getMonth() !== this.currentFocus.getMonth()); }, /** diff --git a/DatePicker/MonthPicker.js b/DatePicker/MonthPicker.js index d4f83f7bc8..6d01fc8fba 100644 --- a/DatePicker/MonthPicker.js +++ b/DatePicker/MonthPicker.js @@ -1,11 +1,9 @@ define([ "delite/register", - "delite/classList", "delite/Widget", "../TimeBase" ], function ( register, - classList, Widget, TimeBase ) { @@ -71,14 +69,14 @@ define([ // If there's a selected month, then set the "d-date-picker-selected" class on it. // Otherwise, set the "d-date-picker-today" class on the present month. this.cells.forEach(function (cell) { - classList.removeClass(cell, "d-date-picker-selected d-date-picker-today"); + cell.classList.remove("d-date-picker-selected", "d-date-picker-today"); }); if (this.month >= 0) { - classList.addClass(this.cells[this.month], "d-date-picker-selected"); + this.cells[this.month].classList.add("d-date-picker-selected"); } else { var presentMonth = (new this.dateClassObj()).getMonth(); - classList.addClass(this.cells[presentMonth], "d-date-picker-today"); + this.cells[presentMonth].classList.add("d-date-picker-today"); } } }, diff --git a/Gruntfile.js b/Gruntfile.js index 61c6a6145e..75e4a7b3ab 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -98,4 +98,4 @@ module.exports = function (grunt) { // Aliases grunt.registerTask("default", ["less"]); grunt.registerTask("jsdoc", "jsdoc-amddcl"); -}; \ No newline at end of file +}; diff --git a/Panel.js b/Panel.js index 6e4239199b..b56e7835e0 100644 --- a/Panel.js +++ b/Panel.js @@ -46,4 +46,4 @@ define(["dcl/dcl", */ closedIconClass: "" }); -}); \ No newline at end of file +}); diff --git a/ProgressBar.js b/ProgressBar.js index 81306529a9..837c8d5a27 100644 --- a/ProgressBar.js +++ b/ProgressBar.js @@ -2,11 +2,10 @@ define([ "dcl/dcl", "delite/register", - "delite/classList", "delite/Widget", "delite/handlebars!./ProgressBar/ProgressBar.html", "requirejs-dplugins/css!./ProgressBar/ProgressBar.css" -], function (dcl, register, classList, Widget, template) { +], function (dcl, register, Widget, template) { /** * A widget that displays the completion progress of a task. * @@ -142,7 +141,7 @@ define([ this.msgNode.innerHTML = this.msgInvertNode.innerHTML = this.formatMessage(this.position, this.value, this.max); var hasExtMsg = this.displayExtMsg && this.position !== -1; - classList.toggleClass(this.msgNode, this.baseClass + "-msg-ext", hasExtMsg); + this.msgNode.classList.toggle(this.baseClass + "-msg-ext", hasExtMsg); if (hasExtMsg) { //set content value to be used by pseudo element d-progress-bar-msg-ext::after this.msgNode.setAttribute("msg-ext", this.formatExtMsg(this.position, this.value, this.max)); @@ -155,7 +154,7 @@ define([ } else { this.removeAttribute("aria-valuetext"); } - classList.toggleClass(this, this.baseClass + "-indeterminate", (this.position === -1)); + this.classList.toggle(this.baseClass + "-indeterminate", (this.position === -1)); }, /** diff --git a/ResponsiveColumns.js b/ResponsiveColumns.js index a387353914..2f2ccc2477 100644 --- a/ResponsiveColumns.js +++ b/ResponsiveColumns.js @@ -1,11 +1,10 @@ /** @module deliteful/ResponsiveColumns */ define([ "delite/register", - "delite/classList", "delite/DisplayContainer", "./channelBreakpoints", "requirejs-dplugins/css!./ResponsiveColumns/ResponsiveColumns.css" -], function (register, classList, DisplayContainer, channelBreakpoints) { +], function (register, DisplayContainer, channelBreakpoints) { /** * A container that lays out its children according to the screen width. This widget relies on CSS media queries * (http://www.w3.org/TR/css3-mediaqueries). You can define any number of screen classes by setting the breakpoints diff --git a/Select.js b/Select.js index c7945a1730..96e62ed593 100644 --- a/Select.js +++ b/Select.js @@ -3,13 +3,12 @@ define([ "dcl/dcl", "ibm-decor/sniff", "delite/register", - "delite/classList", "delite/FormWidget", "delite/StoreMap", "delite/Selection", "delite/handlebars!./Select/Select.html", "requirejs-dplugins/css!./Select/Select.css" -], function (dcl, has, register, classList, +], function (dcl, has, register, FormWidget, StoreMap, Selection, template) { /** @@ -150,10 +149,10 @@ define([ // of the focus pseudo-class because the browsers give the focus // to the underlying select, not to the widget. this.on("focus", function (evt) { - classList.toggleClass(this, "d-select-focus", evt.type === "focus"); + this.classList.toggle("d-select-focus", evt.type === "focus"); }.bind(this), this.valueNode); this.on("blur", function (evt) { - classList.toggleClass(this, "d-select-focus", evt.type === "focus"); + this.classList.toggle("d-select-focus", evt.type === "focus"); }.bind(this), this.valueNode); // Keep delite/Selection's selectedItem/selectedItems in sync after diff --git a/SidePane.js b/SidePane.js index b513a9d571..9b586ad424 100644 --- a/SidePane.js +++ b/SidePane.js @@ -3,12 +3,10 @@ define([ "dcl/dcl", "ibm-decor/sniff", "delite/register", - "delite/classList", "delite/DisplayContainer", - "requirejs-dplugins/Promise!", "requirejs-dplugins/css!./SidePane/SidePane.css" ], - function (dcl, has, register, classList, DisplayContainer, Promise) { + function (dcl, has, register, DisplayContainer) { function prefix(v) { return "-d-side-pane-" + v; } @@ -162,7 +160,7 @@ define([ if (animate) { this.addClass(prefix("animate")); if (nextElement) { - classList.addClass(nextElement, prefix("animate")); + nextElement.classList.add(prefix("animate")); } } @@ -256,7 +254,7 @@ define([ .addClass(prefix(this.mode)); if (nextElement && this._visible) { - classList.toggleClass(nextElement, prefix("translated"), this.mode !== "overlay"); + nextElement.classList.toggle(prefix("translated"), this.mode !== "overlay"); } if (this.mode === "reveal" && !this._visible) { @@ -276,8 +274,8 @@ define([ this.removeClass([prefix("start"), prefix("end")].join(" ")) .addClass(prefix(this.position)); if (nextElement && this._visible) { - classList.removeClass(nextElement, [prefix("start"), prefix("end")].join(" ")); - classList.addClass(nextElement, prefix(this.position)); + nextElement.classList.remove(prefix("start"), prefix("end")); + nextElement.classList.add(prefix(this.position)); } }, @@ -292,8 +290,8 @@ define([ this.removeClass(prefix("animate")); if (nextElement) { - classList.removeClass(nextElement, prefix("animate")); - classList.toggleClass(nextElement, "d-rtl", this.effectiveDir === "rtl"); + nextElement.classList.remove(prefix("animate")); + nextElement.classList.toggle("d-rtl", this.effectiveDir === "rtl"); } if ("mode" in props) { @@ -312,7 +310,7 @@ define([ this.defer(function () { this.addClass(prefix("animate")); if (nextElement) { - classList.addClass(nextElement, prefix("animate")); + nextElement.classList.add(prefix("animate")); } }, this._timing); } @@ -327,9 +325,8 @@ define([ if (this.mode === "push" || this.mode === "reveal") { var nextElement = getNextSibling(this); if (nextElement) { - classList.removeClass(nextElement, - [prefix("nottranslated"), prefix("start"), prefix("end")].join(" ")); - classList.addClass(nextElement, [prefix(this.position), prefix("translated")].join(" ")); + nextElement.classList.remove(prefix("nottranslated"), prefix("start"), prefix("end")); + nextElement.classList.add(prefix(this.position), prefix("translated")); } } } @@ -339,16 +336,14 @@ define([ if (this._visible) { this._visible = false; this._opening = false; - classList.removeClass(this.ownerDocument.body, prefix("no-select")); + this.ownerDocument.body.classList.remove(prefix("no-select")); this.removeClass(prefix("visible")) .addClass(prefix("hidden")); if (this.mode === "push" || this.mode === "reveal") { var nextElement = getNextSibling(this); if (nextElement) { - classList - .removeClass(nextElement, - [prefix("translated"), prefix("start"), prefix("end")].join(" ")) - .addClass(nextElement, [prefix(this.position), prefix("nottranslated")].join(" ")); + nextElement.classList.remove(prefix("translated"), prefix("start"), prefix("end")); + nextElement.classList.add(prefix(this.position), prefix("nottranslated")); } } } @@ -370,7 +365,7 @@ define([ this._moveHandle = this.on("pointermove", this._pointerMoveHandler.bind(this)); this._releaseHandle = this.on("pointerup", this._pointerUpHandler.bind(this)); - classList.addClass(this.ownerDocument.body, prefix("no-select")); + this.ownerDocument.body.classList.add(prefix("no-select")); } }, @@ -407,7 +402,7 @@ define([ _pointerUpHandler: function () { this._opening = false; - classList.removeClass(this.ownerDocument.body, prefix("no-select")); + this.ownerDocument.body.classList.remove(prefix("no-select")); this._resetInteractions(); }, diff --git a/StarRating.js b/StarRating.js index f081a8df24..0176a0f5ac 100644 --- a/StarRating.js +++ b/StarRating.js @@ -2,11 +2,10 @@ define([ "dcl/dcl", "delite/register", - "delite/classList", "delite/FormValueWidget", "requirejs-dplugins/i18n!./StarRating/nls/StarRating", "requirejs-dplugins/css!./StarRating/StarRating.css" -], function (dcl, register, classList, FormValueWidget, messages) { +], function (dcl, register, FormValueWidget, messages) { /** * A widget that displays a rating, usually with stars, and that allows setting a different rating value * by touching the stars. @@ -251,10 +250,10 @@ define([ _updateZeroArea: function () { if (this.readOnly || !this.allowZero) { - classList.addClass(this._zeroSettingArea, "d-hidden"); + this._zeroSettingArea.classList.add("d-hidden"); delete this.focusNode.value; } else { - classList.removeClass(this._zeroSettingArea, "d-hidden"); + this._zeroSettingArea.classList.remove("d-hidden"); // _zeroSettingArea might not fill the whole widget height // so pointer events can land in the underlying focus node this.focusNode.value = 0; diff --git a/Switch.js b/Switch.js index 58d53a09a3..1704c40d67 100644 --- a/Switch.js +++ b/Switch.js @@ -2,11 +2,10 @@ define([ "requirejs-dplugins/has", "delite/register", - "delite/classList", "deliteful/Checkbox", "delite/handlebars!./Switch/Switch.html", "requirejs-dplugins/css!./Switch/Switch.css" -], function (has, register, classList, Checkbox, template) { +], function (has, register, Checkbox, template) { /** * A form-aware switch widget that represents a toggle switch with a sliding knob. @@ -77,9 +76,9 @@ define([ w = parseInt(cs.width, 10); if (!this._drag && Math.abs(e.clientX - this._startX) > 4) { this._drag = true; - classList.removeClass(this._innerNode, "-d-switch-transition"); - classList.removeClass(this._pushNode, "-d-switch-transition"); - classList.removeClass(this._innerWrapperNode, "-d-switch-transition"); + this._innerNode.classList.remove("-d-switch-transition"); + this._pushNode.classList.remove("-d-switch-transition"); + this._innerWrapperNode.classList.remove("-d-switch-transition"); } this._curX = e.clientX; if (this._drag) { @@ -119,9 +118,9 @@ define([ this._drag = false; this._pushNode.style.width = ""; this._innerNode.style.transform = "none"; - classList.addClass(this._innerNode, "-d-switch-transition"); - classList.addClass(this._pushNode, "-d-switch-transition"); - classList.addClass(this._innerWrapperNode, "-d-switch-transition"); + this._innerNode.classList.add("-d-switch-transition"); + this._pushNode.classList.add("-d-switch-transition"); + this._innerWrapperNode.classList.add("-d-switch-transition"); }, _cleanHandlers: function () { diff --git a/ToasterMessage.js b/ToasterMessage.js index 10eb308d7a..bff580fa03 100644 --- a/ToasterMessage.js +++ b/ToasterMessage.js @@ -3,11 +3,9 @@ define([ "dcl/dcl", "delite/Widget", "delite/register", - "delite/classList", - "requirejs-dplugins/Promise!", "./features", "delite/handlebars!./Toaster/ToasterMessage.html" -], function (dcl, Widget, register, classList, Promise, has, template) { +], function (dcl, Widget, register, has, template) { // TODO: this could be abstracted in a separate class, so that it can be used by other widgets // such as the toggle/switch. @@ -481,7 +479,7 @@ define([ } // toggling dismiss button visibility - classList.toggleClass(this._dismissButton, D_HIDDEN, !this.isDismissible()); + this._dismissButton.classList.toggle(D_HIDDEN, !this.isDismissible()); }, _showInDom: function (toaster, animated) { if (animated) { @@ -491,7 +489,7 @@ define([ this.removeClass(toaster.animationInitialClass); this.addClass(toaster.animationEnterClass); listenAnimationEvents(this, function (element) { - classList.removeClass(element, toaster.animationEnterClass); + element.classList.remove(toaster.animationEnterClass); // NOTE: the swipe dismissing is made possible only once the entering animation is done // this is done to avoid the CSS of the animation to interfere with the swipe diff --git a/ViewStack.js b/ViewStack.js index bf5d4d5231..0a311dc43b 100644 --- a/ViewStack.js +++ b/ViewStack.js @@ -2,14 +2,12 @@ define([ "dcl/dcl", "ibm-decor/sniff", - "requirejs-dplugins/Promise!", "delite/register", - "delite/classList", "delite/DisplayContainer", "requirejs-dplugins/css!./ViewStack/ViewStack.css", "requirejs-dplugins/css!./ViewStack/transitions/slide.css", "requirejs-dplugins/css!./ViewStack/transitions/reveal.css" -], function (dcl, has, Promise, register, classList, DisplayContainer) { +], function (dcl, has, register, DisplayContainer) { function setVisibility(node, val) { if (node) { if (val) { @@ -24,7 +22,7 @@ define([ function setReverse(node) { if (node) { - classList.addClass(node, "-d-view-stack-reverse"); + node.classList.add("-d-view-stack-reverse"); } } @@ -223,11 +221,11 @@ define([ if (transition !== "none") { if (origin) { promises.push(this._startNodeTransition(origin)); - classList.addClass(origin, transitionClass(transition)); + origin.classList.add(transitionClass(transition)); } if (target) { promises.push(this._startNodeTransition(target)); - classList.addClass(target, transitionClass(transition) + " -d-view-stack-in"); + target.classList.add(transitionClass(transition), "-d-view-stack-in"); } if (reverse) { setReverse(origin); @@ -237,17 +235,17 @@ define([ // TODO: figure out why the delay is needed this.defer(function () { if (target) { - classList.addClass(target, "-d-view-stack-transition"); + target.classList.add("-d-view-stack-transition"); } if (origin) { - classList.addClass(origin, "-d-view-stack-transition -d-view-stack-out"); + origin.classList.add("-d-view-stack-transition", "-d-view-stack-out"); } if (reverse) { setReverse(origin); setReverse(target); } if (target) { - classList.addClass(target, "-d-view-stack-in"); + target.classList.add("-d-view-stack-in"); } }, this._timing); } else { @@ -257,8 +255,8 @@ define([ } return Promise.all(promises).then(function () { this.removeClass("-d-view-stack-transition"); - classList.removeClass(target, "-d-view-stack-transition -d-view-stack-in"); - classList.removeClass(origin, "-d-view-stack-transition -d-view-stack-out"); + target.classList.remove("-d-view-stack-transition", "-d-view-stack-in"); + origin.classList.remove("-d-view-stack-transition", "-d-view-stack-out"); }.bind(this)); }, diff --git a/intern.json b/intern.json index b147341f3c..6abc0b8cf4 100644 --- a/intern.json +++ b/intern.json @@ -13,6 +13,10 @@ "basePath": "../", + "plugins": [ + "../deliteful/tests/ie-polyfills.js" + ], + "node": { "loader": { "script": "./intern-requirejs-loader.js", diff --git a/list/List.js b/list/List.js index 154db50a45..0cf885bb3f 100644 --- a/list/List.js +++ b/list/List.js @@ -4,7 +4,6 @@ define([ "delite/a11y", "delite/features", "delite/register", - "delite/classList", "delite/Selection", "delite/KeyNav", "delite/StoreMap", @@ -19,7 +18,6 @@ define([ a11y, has, register, - classList, Selection, KeyNav, StoreMap, @@ -354,8 +352,7 @@ define([ if ("selectionMode" in props || "type" in props) { // Update aria attributes - classList.removeClass(this.containerNode, this._cssClasses.selectable); - classList.removeClass(this.containerNode, this._cssClasses.multiselectable); + this.containerNode.classList.remove(this._cssClasses.selectable, this._cssClasses.multiselectable); this.containerNode.removeAttribute("aria-multiselectable"); if (this.selectionMode === "none") { // update aria-selected attribute on unselected items @@ -363,14 +360,14 @@ define([ var child = this.containerNode.children[i]; if (child.hasAttribute("aria-selected")) { child.removeAttribute("aria-selected"); - classList.removeClass(child, this._cssClasses.selected); + child.classList.remove(this._cssClasses.selected); } } } else { if (this.selectionMode === "single" || this.selectionMode === "radio") { - classList.addClass(this.containerNode, this._cssClasses.selectable); + this.containerNode.classList.add(this._cssClasses.selectable); } else { - classList.addClass(this.containerNode, this._cssClasses.multiselectable); + this.containerNode.classList.add(this._cssClasses.multiselectable); this.containerNode.setAttribute("aria-multiselectable", "true"); } // update aria-selected attribute on unselected items @@ -380,7 +377,7 @@ define([ if (child.tagName.toLowerCase() === this.itemRenderer.tag && !child.hasAttribute("aria-selected")) { child.setAttribute("aria-selected", "false"); - classList.removeClass(child, this._cssClasses.selected); // TODO: NOT NEEDED ? + child.classList.remove(this._cssClasses.selected); // TODO: NOT NEEDED ? } } } @@ -615,7 +612,7 @@ define([ // https://www.w3.org/TR/wai-aria-1.1/#aria-current role is for. renderer.setAttribute("aria-selected", itemSelected ? "true" : "false"); } - classList.toggleClass(renderer, this._cssClasses.selected, itemSelected); + renderer.classList.toggle(this._cssClasses.selected, itemSelected); } } }, @@ -872,7 +869,7 @@ define([ if (this.selectionMode !== "none" && (this.type === "grid" || this.type === "listbox")) { var itemSelected = !!this.isSelected(item); renderer.setAttribute("aria-selected", itemSelected ? "true" : "false"); - classList.toggleClass(renderer, this._cssClasses.selected, itemSelected); + renderer.classList.toggle(this._cssClasses.selected, itemSelected); } return renderer; }, diff --git a/list/List/nls/Pageable.js b/list/List/nls/Pageable.js index 019e6c6328..75405761fc 100644 --- a/list/List/nls/Pageable.js +++ b/list/List/nls/Pageable.js @@ -4,4 +4,4 @@ define({ root: "loading-message": "", "loading-panel-message": "" }) -}); \ No newline at end of file +}); diff --git a/list/Loader.js b/list/Loader.js index a2ab5ed2f0..59f899137c 100644 --- a/list/Loader.js +++ b/list/Loader.js @@ -39,4 +39,4 @@ define([ */ loading: false }); -}); \ No newline at end of file +}); diff --git a/list/PageableList.js b/list/PageableList.js index 3f17c1a01b..1ca255bf62 100644 --- a/list/PageableList.js +++ b/list/PageableList.js @@ -3,13 +3,12 @@ define([ "dcl/dcl", "delite/register", "dojo/string", - "requirejs-dplugins/Promise!", "ibm-decor/sniff", "./List", "./Renderer", "delite/handlebars!./List/PageableList.html", "requirejs-dplugins/i18n!./List/nls/Pageable" -], function (dcl, register, string, Promise, has, List, Renderer, template, messages) { +], function (dcl, register, string, has, List, Renderer, template, messages) { /** * A widget that renders a scrollable list of items and provides paging. diff --git a/tests/boilerplate.js b/tests/boilerplate.js index 42eaa39797..7767d89ddb 100644 --- a/tests/boilerplate.js +++ b/tests/boilerplate.js @@ -1,5 +1,5 @@ // module: -// delite/tests/boilerplate +// deliteful/tests/boilerplate // description: // A "); +} + // Setup configuration options for the loader /* global require:true */ require = { @@ -69,31 +69,5 @@ require = { locale: locale || "en-us" }; -for (var key2 in overrides) { - require[key2] = overrides[key2]; -} - -// Output the boilerplate text to load the loader. -document.write(""); - -// On IE9 the following inlined script will run before dojo has finished loading, leading to an error because require() -// isn't defined yet. Workaround it by putting the code in a separate file. -document.write(""); - -/* global boilerplateOnLoad:true */ -boilerplateOnLoad = function () { - // This function is the first registered domReady() callback. - - // RTL - if (dir === "rtl") { - // set dir=rtl on node - document.body.parentNode.setAttribute("dir", "rtl"); - - // pretend all the labels are in an RTL language, because - // that affects how they lay out relative to inline form widgets - var labels = document.body.querySelectorAll("label"); - for (var k = 0; k < labels.length; k++) { - labels[k].setAttribute("dir", "rtl"); - } - } -}; +// Load Requirejs. +document.write(""); \ No newline at end of file diff --git a/tests/boilerplateOnload.js b/tests/boilerplateOnload.js deleted file mode 100644 index ba8d17dcce..0000000000 --- a/tests/boilerplateOnload.js +++ /dev/null @@ -1,4 +0,0 @@ -// Part of boilerplate.js but need to put it in a separate file for IE9, so it doesn't run until loader has finished -// loading and require is defined -/* global boilerplateOnLoad */ -require(["requirejs-domready/domReady!"], boilerplateOnLoad); diff --git a/tests/functional/DatePicker.html b/tests/functional/DatePicker.html index 17fde7ed20..7ce7c5735f 100644 --- a/tests/functional/DatePicker.html +++ b/tests/functional/DatePicker.html @@ -10,18 +10,12 @@ - + + - - + +