Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1936)

Unified Diff: chrome/browser/resources/bluetooth_internals/device_table.js

Issue 2488093003: bluetooth: Componentize device list fixes (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/bluetooth_internals/device_table.js
diff --git a/chrome/browser/resources/bluetooth_internals/device_table.js b/chrome/browser/resources/bluetooth_internals/device_table.js
index b4db9b030f079ea9f7947d784a2b3442efd672e9..04a03dd23bb8e84359d582d04bccc75089d4ad47 100644
--- a/chrome/browser/resources/bluetooth_internals/device_table.js
+++ b/chrome/browser/resources/bluetooth_internals/device_table.js
@@ -3,12 +3,11 @@
// found in the LICENSE file.
/**
- * Javascript for DeviceTable UI, served from
- * chrome://bluetooth-internals/.
+ * Javascript for DeviceTable UI, served from chrome://bluetooth-internals/.
*/
cr.define('device_table', function() {
- var REMOVED_CSS = 'removed';
+ var REMOVED_CLASS_NAME = 'removed';
Dan Beam 2016/11/10 03:22:59 why do you need this constant now? can you just i
mbrunson 2016/11/10 04:06:03 Ah, yes. Since it's only used in one place now, I
/**
* A table that lists the devices and responds to changes in the given
@@ -17,7 +16,8 @@ cr.define('device_table', function() {
* @extends {HTMLTableElement}
*/
var DeviceTable = cr.ui.define(function() {
- // @type {Array<device_collection.Device>}
+ // @type {?Array<device_collection.Device>}
Dan Beam 2016/11/10 03:22:59 // comments aren't jsdoc you need /** These type
mbrunson 2016/11/10 04:06:03 Ah ok. Done.
+ // @private
this.devices_ = null;
return document.importNode($('table-template').content.children[0],
@@ -32,7 +32,9 @@ cr.define('device_table', function() {
* table body and headers.
*/
decorate: function() {
+ // @private
this.body_ = this.tBodies[0];
+ // @private
this.headers_ = this.tHead.rows[0].cells;
},
@@ -117,11 +119,7 @@ cr.define('device_table', function() {
assert(this.body_.rows[index], 'Row ' + index + ' is not in the table.');
var row = this.body_.rows[index];
- if (device.removed) {
- row.classList.add(REMOVED_CSS);
- } else {
- row.classList.remove(REMOVED_CSS);
- }
+ row.classList.toggle(REMOVED_CLASS_NAME, device.removed);
// Update the properties based on the header field path.
for (var i = 0; i < this.headers_.length; i++) {

Powered by Google App Engine
This is Rietveld 408576698