Bug 1425244 - Enable ESLint rule object-shorthand for accessible/. r?surkov draft
authorMark Banner <standard8@mozilla.com>
Mon, 11 Dec 2017 13:08:14 +0000
changeset 711858 efe2832ac2cd5e23b73a9086cda84f578be28a17
parent 711692 8062887ff0d9382ea84177f2c21f62dc0e613d9e
child 711859 dae226e9f64cbe94c086a0f4853ebe18792fbf4b
push id93179
push userbmo:standard8@mozilla.com
push dateThu, 14 Dec 2017 22:08:47 +0000
reviewerssurkov
bugs1425244
milestone59.0a1
Bug 1425244 - Enable ESLint rule object-shorthand for accessible/. r?surkov MozReview-Commit-ID: 9LCLDppVj1t
accessible/.eslintrc.js
accessible/jsat/AccessFu.jsm
accessible/jsat/EventManager.jsm
accessible/jsat/Gestures.jsm
accessible/jsat/Presentation.jsm
accessible/tests/mochitest/autocomplete.js
accessible/tests/mochitest/events/test_flush.html
accessible/tests/mochitest/jsat/jsatcommon.js
accessible/tests/mochitest/pivot.js
accessible/tests/mochitest/relations/test_ui_modalprompt.html
accessible/tests/mochitest/table.js
accessible/tests/mochitest/text/test_atcaretoffset.html
--- a/accessible/.eslintrc.js
+++ b/accessible/.eslintrc.js
@@ -4,14 +4,13 @@ module.exports = {
   "rules": {
     // Warn about cyclomatic complexity in functions.
     "complexity": ["error", 42],
 
     // XXX These are rules that are enabled in the recommended configuration, but
     // disabled here due to failures when initially implemented. They should be
     // removed (and hence enabled) at some stage.
     "consistent-return": "off",
-    "object-shorthand": "off",
     "no-unexpected-multiline": "off",
     "no-unsafe-finally": "off",
     "no-useless-call": "off",
   }
 };
--- a/accessible/jsat/AccessFu.jsm
+++ b/accessible/jsat/AccessFu.jsm
@@ -293,17 +293,17 @@ this.AccessFu = { // jshint ignore:line
 
   _handleMessageManager: function _handleMessageManager(aMessageManager) {
     if (this._enabled) {
       this._addMessageListeners(aMessageManager);
     }
     this._loadFrameScript(aMessageManager);
   },
 
-  onEvent: function(event, data, callback) {
+  onEvent(event, data, callback) {
     switch (event) {
       case "Accessibility:Settings":
         this._systemPref = data.enabled;
         this._enableOrDisable();
         break;
       case "Accessibility:NextObject":
       case "Accessibility:PreviousObject": {
         let rule = "Simple";
@@ -420,18 +420,17 @@ this.AccessFu = { // jshint ignore:line
 
   /**
    * Adjusts the given bounds relative to the given browser.
    * @param {Rect} aJsonBounds the bounds to adjust
    * @param {browser} aBrowser the browser we want the bounds relative to
    * @param {bool} aToCSSPixels whether to convert to CSS pixels (as opposed to
    *               device pixels)
    */
-  adjustContentBounds:
-    function(aJsonBounds, aBrowser, aToCSSPixels) {
+  adjustContentBounds(aJsonBounds, aBrowser, aToCSSPixels) {
       let bounds = new Rect(aJsonBounds.left, aJsonBounds.top,
                             aJsonBounds.right - aJsonBounds.left,
                             aJsonBounds.bottom - aJsonBounds.top);
       let win = Utils.win;
       let dpr = win.devicePixelRatio;
       let offset = { left: -win.mozInnerScreenX, top: -win.mozInnerScreenY };
 
       // Add the offset; the offset is in CSS pixels, so multiply the
@@ -874,17 +873,17 @@ var Input = {
   },
 
   activateCurrent: function activateCurrent(aData, aActivateIfKey = false) {
     let mm = Utils.getMessageManager(Utils.CurrentBrowser);
     let offset = aData && typeof aData.keyIndex === "number" ?
                  aData.keyIndex - Output.brailleState.startOffset : -1;
 
     mm.sendAsyncMessage("AccessFu:Activate",
-                        {offset: offset, activateIfKey: aActivateIfKey});
+                        {offset, activateIfKey: aActivateIfKey});
   },
 
   sendContextMenuMessage: function sendContextMenuMessage() {
     let mm = Utils.getMessageManager(Utils.CurrentBrowser);
     mm.sendAsyncMessage("AccessFu:ContextMenu", {});
   },
 
   setEditState: function setEditState(aEditState) {
--- a/accessible/jsat/EventManager.jsm
+++ b/accessible/jsat/EventManager.jsm
@@ -234,17 +234,17 @@ this.EventManager.prototype = {
           Ci.nsIAccessibleObjectAttributeChangedEvent);
         if (evt.changedAttribute !== "aria-hidden") {
           // Only handle aria-hidden attribute change.
           break;
         }
         let hidden = Utils.isHidden(aEvent.accessible);
         this[hidden ? "_handleHide" : "_handleShow"](evt);
         if (this.inTest) {
-          this.sendMsgFunc("AccessFu:AriaHidden", { hidden: hidden });
+          this.sendMsgFunc("AccessFu:AriaHidden", { hidden });
         }
         break;
       }
       case Events.SHOW:
       {
         this._handleShow(aEvent);
         break;
       }
--- a/accessible/jsat/Gestures.jsm
+++ b/accessible/jsat/Gestures.jsm
@@ -300,17 +300,17 @@ function compileDetail(aType, aPoints, k
       maxDeltaY = deltaY;
     }
     // Since the gesture is resolving, reset the points' distance information
     // since they are passed to the next potential gesture.
     point.reset();
   }
   return {
     type: aType,
-    touches: touches,
+    touches,
     deltaX: maxDeltaX,
     deltaY: maxDeltaY
   };
 }
 
 /**
  * A general gesture object.
  * @param {Number} aTimeStamp An original pointer event's timeStamp that started
--- a/accessible/jsat/Presentation.jsm
+++ b/accessible/jsat/Presentation.jsm
@@ -164,17 +164,17 @@ VisualPresenter.prototype.viewportChange
     if (Utils.isAliveAndVisible(currentAcc)) {
       let bounds = (start === -1 && end === -1) ? Utils.getBounds(currentAcc) :
                    Utils.getTextBounds(currentAcc, start, end);
 
       return {
         type: this.type,
         details: {
           eventType: "viewport-change",
-          bounds: bounds,
+          bounds,
           padding: this.BORDER_PADDING
         }
       };
     }
 
     return null;
   };
 
@@ -193,17 +193,17 @@ VisualPresenter.prototype.pivotChanged =
             aContext.bounds : Utils.getTextBounds(aContext.accessibleForBounds,
                                                   aContext.startOffset,
                                                   aContext.endOffset);
 
       return {
         type: this.type,
         details: {
           eventType: "vc-change",
-          bounds: bounds,
+          bounds,
           padding: this.BORDER_PADDING
         }
       };
     } catch (e) {
       Logger.logException(e, "Failed to get bounds");
       return null;
     }
   };
@@ -292,17 +292,17 @@ AndroidPresenter.prototype.pivotChanged 
       androidEvents.push({eventType: (isExploreByTouch) ?
                            this.ANDROID_VIEW_HOVER_ENTER : focusEventType,
                          text: Utils.localize(UtteranceGenerator.genForContext(
                            aContext)),
                          bounds: aContext.bounds,
                          clickable: aContext.accessible.actionCount > 0,
                          checkable: state.contains(States.CHECKABLE),
                          checked: state.contains(States.CHECKED),
-                         brailleOutput: brailleOutput});
+                         brailleOutput});
     }
 
 
     return {
       type: this.type,
       details: androidEvents
     };
   };
@@ -318,17 +318,17 @@ AndroidPresenter.prototype.actionInvoked
       text = Utils.localize(UtteranceGenerator.genForAction(aObject,
         aActionName));
     }
 
     return {
       type: this.type,
       details: [{
         eventType: this.ANDROID_VIEW_CLICKED,
-        text: text,
+        text,
         checked: state.contains(States.CHECKED)
       }]
     };
   };
 
 AndroidPresenter.prototype.tabSelected =
   function AndroidPresenter_tabSelected(aDocContext, aVCContext) {
     // Send a pivot change message with the full context utterance for this doc.
@@ -377,17 +377,17 @@ AndroidPresenter.prototype.textSelection
         aText, aStart, aEnd, aOldStart, aOldEnd, aIsFromUserInput).details;
 
       androidEvents.push({
         eventType: this.ANDROID_VIEW_TEXT_SELECTION_CHANGED,
         text: [aText],
         fromIndex: aStart,
         toIndex: aEnd,
         itemCount: aText.length,
-        brailleOutput: brailleOutput
+        brailleOutput
       });
     }
 
     if (Utils.AndroidSdkVersion >= 16 && aIsFromUserInput) {
       let [from, to] = aOldStart < aStart ?
         [aOldStart, aStart] : [aStart, aOldStart];
       androidEvents.push({
         eventType: this.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
--- a/accessible/tests/mochitest/autocomplete.js
+++ b/accessible/tests/mochitest/autocomplete.js
@@ -71,17 +71,17 @@ function ResultsHeap(aValues, aComments)
 
 ResultsHeap.prototype =
 {
   constructor: ResultsHeap,
 
   /**
    * Return AutoCompleteResult for the given search string.
    */
-  getAutoCompleteResultFor: function(aSearchString) {
+  getAutoCompleteResultFor(aSearchString) {
     var values = [], comments = [];
     for (var idx = 0; idx < this.values.length; idx++) {
       if (this.values[idx].indexOf(aSearchString) != -1) {
         values.push(this.values[idx]);
         comments.push(this.comments[idx]);
       }
     }
     return new AutoCompleteResult(values, comments);
@@ -100,36 +100,35 @@ function AutoCompleteSearch(aName, aAllR
   this.allResults = aAllResults;
 }
 
 AutoCompleteSearch.prototype =
 {
   constructor: AutoCompleteSearch,
 
   // nsIAutoCompleteSearch implementation
-  startSearch: function(aSearchString, aSearchParam, aPreviousResult,
-                        aListener) {
+  startSearch(aSearchString, aSearchParam, aPreviousResult, aListener) {
     var result = this.allResults.getAutoCompleteResultFor(aSearchString);
     aListener.onSearchResult(this, result);
   },
 
-  stopSearch: function() {},
+  stopSearch() {},
 
   // nsISupports implementation
-  QueryInterface: function(iid) {
+  QueryInterface(iid) {
     if (iid.equals(nsISupports) ||
         iid.equals(nsIFactory) ||
         iid.equals(nsIAutoCompleteSearch))
       return this;
 
     throw Components.results.NS_ERROR_NO_INTERFACE;
   },
 
   // nsIFactory implementation
-  createInstance: function(outer, iid) {
+  createInstance(outer, iid) {
     return this.QueryInterface(iid);
   },
 
   // Search name. Used by AutoCompleteController.
   name: null,
 
   // Results heap.
   allResults: null
@@ -157,44 +156,44 @@ AutoCompleteResult.prototype =
   searchResult: null,
 
   defaultIndex: 0,
 
   get matchCount() {
     return this.values.length;
   },
 
-  getValueAt: function(aIndex) {
+  getValueAt(aIndex) {
     return this.values[aIndex];
   },
 
-  getLabelAt: function(aIndex) {
+  getLabelAt(aIndex) {
     return this.getValueAt(aIndex);
   },
 
-  getCommentAt: function(aIndex) {
+  getCommentAt(aIndex) {
     return this.comments[aIndex];
   },
 
-  getStyleAt: function(aIndex) {
+  getStyleAt(aIndex) {
     return null;
   },
 
-  getImageAt: function(aIndex) {
+  getImageAt(aIndex) {
     return "";
   },
 
-  getFinalCompleteValueAt: function(aIndex) {
+  getFinalCompleteValueAt(aIndex) {
     return this.getValueAt(aIndex);
   },
 
-  removeValueAt: function(aRowIndex, aRemoveFromDb) {},
+  removeValueAt(aRowIndex, aRemoveFromDb) {},
 
   // nsISupports implementation
-  QueryInterface: function(iid) {
+  QueryInterface(iid) {
     if (iid.equals(nsISupports) ||
         iid.equals(nsIAutoCompleteResult))
       return this;
 
     throw Components.results.NS_ERROR_NO_INTERFACE;
   },
 
   // Data
--- a/accessible/tests/mochitest/events/test_flush.html
+++ b/accessible/tests/mochitest/events/test_flush.html
@@ -15,17 +15,17 @@
           src="../common.js"></script>
   <script type="application/javascript"
           src="../events.js"></script>
 
   <script type="application/javascript">
     SimpleTest.expectAssertions(0, 1);
 
     var gFocusHandler = {
-      handleEvent: function(aEvent) {
+      handleEvent(aEvent) {
         switch (this.count) {
           case 0:
             is(aEvent.DOMNode, getNode("input1"),
                "Focus event for input1 was expected!");
             getAccessible("input2").takeFocus();
             break;
 
           case 1:
--- a/accessible/tests/mochitest/jsat/jsatcommon.js
+++ b/accessible/tests/mochitest/jsat/jsatcommon.js
@@ -183,17 +183,17 @@ function AccessFuContentTest(aFuncResult
   this.queue = aFuncResultPairs;
 }
 
 AccessFuContentTest.prototype = {
   expected: [],
   currentAction: null,
   actionNum: -1,
 
-  start: function(aFinishedCallback) {
+  start(aFinishedCallback) {
     Logger.logLevel = Logger.DEBUG;
     this.finishedCallback = aFinishedCallback;
     var self = this;
 
     // Get top content message manager, and set it up.
     this.mms = [Utils.getMessageManager(currentBrowser())];
     this.setupMessageManager(this.mms[0], function() {
       // Get child message managers and set them up
@@ -215,34 +215,34 @@ AccessFuContentTest.prototype = {
               self.pump();
             }
           });
         }
       }
     });
   },
 
-  finish: function() {
+  finish() {
     Logger.logLevel = Logger.INFO;
     for (var mm of this.mms) {
         mm.sendAsyncMessage("AccessFu:Stop");
         mm.removeMessageListener("AccessFu:Present", this);
         mm.removeMessageListener("AccessFu:Input", this);
         mm.removeMessageListener("AccessFu:CursorCleared", this);
         mm.removeMessageListener("AccessFu:Focused", this);
         mm.removeMessageListener("AccessFu:AriaHidden", this);
         mm.removeMessageListener("AccessFu:Ready", this);
         mm.removeMessageListener("AccessFu:ContentStarted", this);
       }
     if (this.finishedCallback) {
       this.finishedCallback();
     }
   },
 
-  setupMessageManager:  function(aMessageManager, aCallback) {
+  setupMessageManager(aMessageManager, aCallback) {
     function contentScript() {
       addMessageListener("AccessFuTest:Focus", function(aMessage) {
         var elem = content.document.querySelector(aMessage.json.selector);
         if (elem) {
           if (aMessage.json.blur) {
             elem.blur();
           } else {
             elem.focus();
@@ -266,17 +266,17 @@ AccessFuContentTest.prototype = {
     });
 
     aMessageManager.loadFrameScript(
       "chrome://global/content/accessibility/content-script.js", false);
     aMessageManager.loadFrameScript(
       "data:,(" + contentScript.toString() + ")();", false);
   },
 
-  pump: function() {
+  pump() {
     this.expected.shift();
     if (this.expected.length) {
       return;
     }
 
     var currentPair = this.queue.shift();
 
     if (currentPair) {
@@ -294,17 +294,17 @@ AccessFuContentTest.prototype = {
       if (!this.expected[0]) {
        this.pump();
      }
     } else {
       this.finish();
     }
   },
 
-  receiveMessage: function(aMessage) {
+  receiveMessage(aMessage) {
     var expected = this.expected[0];
 
     if (!expected) {
       return;
     }
 
     var actionsString = typeof this.currentAction === "function" ?
       this.currentAction.name + "()" : JSON.stringify(this.currentAction);
--- a/accessible/tests/mochitest/pivot.js
+++ b/accessible/tests/mochitest/pivot.js
@@ -18,43 +18,43 @@ const NS_ERROR_INVALID_ARG = 0x80070057;
 // //////////////////////////////////////////////////////////////////////////////
 // Traversal rules
 
 /**
  * Rule object to traverse all focusable nodes and text nodes.
  */
 var HeadersTraversalRule =
 {
-  getMatchRoles: function(aRules) {
+  getMatchRoles(aRules) {
     aRules.value = [ROLE_HEADING];
     return aRules.value.length;
   },
 
   preFilter: PREFILTER_INVISIBLE,
 
-  match: function(aAccessible) {
+  match(aAccessible) {
     return FILTER_MATCH;
   },
 
   QueryInterface: XPCOMUtils.generateQI([nsIAccessibleTraversalRule])
 };
 
 /**
  * Traversal rule for all focusable nodes or leafs.
  */
 var ObjectTraversalRule =
 {
-  getMatchRoles: function(aRules) {
+  getMatchRoles(aRules) {
     aRules.value = [];
     return 0;
   },
 
   preFilter: PREFILTER_INVISIBLE | PREFILTER_ARIA_HIDDEN | PREFILTER_TRANSPARENT,
 
-  match: function(aAccessible) {
+  match(aAccessible) {
     var rv = FILTER_IGNORE;
     var role = aAccessible.role;
     if (hasState(aAccessible, STATE_FOCUSABLE) &&
         (role != ROLE_DOCUMENT && role != ROLE_INTERNAL_FRAME))
       rv = FILTER_IGNORE_SUBTREE | FILTER_MATCH;
     else if (aAccessible.childCount == 0 &&
              role != ROLE_STATICTEXT && aAccessible.name.trim())
       rv = FILTER_MATCH;
--- a/accessible/tests/mochitest/relations/test_ui_modalprompt.html
+++ b/accessible/tests/mochitest/relations/test_ui_modalprompt.html
@@ -29,17 +29,17 @@
         return false;
       }
     }
 
     function showAlert() {
       this.eventSeq = [
         {
           type: EVENT_SHOW,
-          match: function(aEvent) {
+          match(aEvent) {
             return aEvent.accessible.role == ROLE_DIALOG;
           }
         }
       ];
 
       this.invoke = function showAlert_invoke() {
         window.setTimeout(
           function() {
--- a/accessible/tests/mochitest/table.js
+++ b/accessible/tests/mochitest/table.js
@@ -133,19 +133,17 @@ function testTableStruct(aIdentifier, aC
           role = ROLE_ROWHEADER;
           break;
         case kColHeaderCell:
           role = ROLE_COLUMNHEADER;
           break;
       }
 
       if (role != ROLE_NOTHING) {
-        var cellObj = {
-          role: role
-        };
+        var cellObj = { role };
         rowObj.children.push(cellObj);
       }
     }
 
     tableObj.children.push(rowObj);
   }
 
   testAccessibleTree(aIdentifier, tableObj);
--- a/accessible/tests/mochitest/text/test_atcaretoffset.html
+++ b/accessible/tests/mochitest/text/test_atcaretoffset.html
@@ -63,26 +63,26 @@
             this.mAtWrappedLineEnd = true;
           else
             this.mLine = nextLine;
         }
 
         return true;
       };
 
-      Object.defineProperty(this, "offset", { get: function() { return this.mOffset; }
+      Object.defineProperty(this, "offset", { get() { return this.mOffset; }
       });
 
-      Object.defineProperty(this, "offsetDescr", { get: function() {
+      Object.defineProperty(this, "offsetDescr", { get() {
           return this.mOffset + " offset (" + this.mLine.number + " line, " +
             (this.mOffset - this.mLine.start) + " offset on the line)";
         }
       });
 
-      Object.defineProperty(this, "tests", { get: function() {
+      Object.defineProperty(this, "tests", { get() {
           // Line boundary tests.
           var cLine = this.mLine;
           var pLine = cLine.prevLine;
           var ppLine = pLine.prevLine;
           var nLine = cLine.nextLine;
           var nnLine = nLine.nextLine;
 
           var lineTests = [
@@ -157,17 +157,17 @@
               this.mAtWrappedLineEnd ? this.offset : nextOffset,
               this.mAtWrappedLineEnd ? nextOffset : nextAfterNextOffset ]
           ];
 
           return lineTests.concat(wordTests.concat(charTests));
         }
       });
 
-      Object.defineProperty(this, "failures", { get: function() {
+      Object.defineProperty(this, "failures", { get() {
           if (this.mOffset == this.mLine.start)
             return this.mLine.lineStartFailures;
           if (this.mOffset == this.mLine.end)
             return this.mLine.lineEndFailures;
           return [];
         }
       });
 
@@ -176,133 +176,133 @@
       this.mAtWrappedLineEnd = false;
       this.mWord = this.mLine.firstWord;
     }
 
     /**
      * A line object. Allows to navigate by lines and by words.
      */
     function line(aWholeText, aLines, aIndex) {
-      Object.defineProperty(this, "prevLine", { get: function() {
+      Object.defineProperty(this, "prevLine", { get() {
           return new line(aWholeText, aLines, aIndex - 1);
         }
       });
-      Object.defineProperty(this, "nextLine", { get: function() {
+      Object.defineProperty(this, "nextLine", { get() {
           return new line(aWholeText, aLines, aIndex + 1);
         }
       });
 
-      Object.defineProperty(this, "start", { get: function() {
+      Object.defineProperty(this, "start", { get() {
           if (aIndex < 0)
             return 0;
 
           if (aIndex >= aLines.length)
             return aWholeText.length;
 
           return aLines[aIndex][2];
         }
       });
-      Object.defineProperty(this, "end", { get: function() {
+      Object.defineProperty(this, "end", { get() {
           if (aIndex < 0)
             return 0;
 
           if (aIndex >= aLines.length)
             return aWholeText.length;
 
           return aLines[aIndex][3];
         }
       });
 
-      Object.defineProperty(this, "number", { get: function() { return aIndex; }
+      Object.defineProperty(this, "number", { get() { return aIndex; }
       });
-      Object.defineProperty(this, "wholeText", { get: function() { return aWholeText; }
+      Object.defineProperty(this, "wholeText", { get() { return aWholeText; }
       });
       this.isFakeLine = function line_isFakeLine() {
         return aIndex < 0 || aIndex >= aLines.length;
       };
 
-      Object.defineProperty(this, "lastWord", { get: function() {
+      Object.defineProperty(this, "lastWord", { get() {
           if (aIndex < 0)
             return new word(this, [], -1);
           if (aIndex >= aLines.length)
             return new word(this, [], 0);
 
           var words = aLines[aIndex][4].words;
           return new word(this, words, words.length - 2);
         }
       });
-      Object.defineProperty(this, "firstWord", { get: function() {
+      Object.defineProperty(this, "firstWord", { get() {
           if (aIndex < 0)
             return new word(this, [], -1);
           if (aIndex >= aLines.length)
             return new word(this, [], 0);
 
           var words = aLines[aIndex][4].words;
           return new word(this, words, 0);
         }
       });
 
       this.isLastWord = function line_isLastWord(aWord) {
         var lastWord = this.lastWord;
         return lastWord.start == aWord.start && lastWord.end == aWord.end;
       };
 
-      Object.defineProperty(this, "lineStartFailures", { get: function() {
+      Object.defineProperty(this, "lineStartFailures", { get() {
           if (aIndex < 0 || aIndex >= aLines.length)
             return [];
 
           return aLines[aIndex][4].lsf || [];
         }
       });
-      Object.defineProperty(this, "lineEndFailures", { get: function() {
+      Object.defineProperty(this, "lineEndFailures", { get() {
           if (aIndex < 0 || aIndex >= aLines.length)
             return [];
 
           return aLines[aIndex][4].lef || [];
         }
       });
     }
 
     /**
      * A word object. Allows to navigate by words.
      */
     function word(aLine, aWords, aIndex) {
-      Object.defineProperty(this, "prevWord", { get: function() {
+      Object.defineProperty(this, "prevWord", { get() {
           if (aIndex >= 2)
             return new word(aLine, aWords, aIndex - 2);
 
           var prevLineLastWord = aLine.prevLine.lastWord;
           if (this.start == prevLineLastWord.start && !this.isFakeStartWord())
             return prevLineLastWord.prevWord;
           return prevLineLastWord;
         }
       });
-      Object.defineProperty(this, "nextWord", { get: function() {
+      Object.defineProperty(this, "nextWord", { get() {
           if (aIndex + 2 < aWords.length)
             return new word(aLine, aWords, aIndex + 2);
 
           var nextLineFirstWord = aLine.nextLine.firstWord;
           if (this.end == nextLineFirstWord.end && !this.isFakeEndWord())
             return nextLineFirstWord.nextWord;
           return nextLineFirstWord;
         }
       });
 
-      Object.defineProperty(this, "line", { get: function() { return aLine; } });
+      Object.defineProperty(this, "line", { get() { return aLine; } });
 
-      Object.defineProperty(this, "start", { get: function() {
+      Object.defineProperty(this, "start", { get() {
           if (this.isFakeStartWord())
             return 0;
 
           if (this.isFakeEndWord())
             return aLine.end;
            return aWords[aIndex];
         }
       });
-      Object.defineProperty(this, "end", { get: function() {
+      Object.defineProperty(this, "end", { get() {
           if (this.isFakeStartWord())
             return 0;
 
           return this.isFakeEndWord() ? aLine.end : aWords[aIndex + 1];
         }
       });
 
       this.toString = function word_toString() {