hyperlink.js (1365B)
1 /* import-globals-from ../common.js */ 2 /* import-globals-from ../events.js */ 3 /* import-globals-from ../states.js */ 4 5 /** 6 * Focus hyperlink invoker. 7 * 8 * @param aID [in] hyperlink identifier 9 * @param aSelectedAfter [in] specifies if hyperlink is selected/focused after 10 * the focus 11 */ 12 function focusLink(aID, aSelectedAfter) { 13 this.node = getNode(aID); 14 this.accessible = getAccessible(this.node); 15 16 this.eventSeq = []; 17 this.unexpectedEventSeq = []; 18 19 var checker = new invokerChecker(EVENT_FOCUS, this.accessible); 20 if (aSelectedAfter) { 21 this.eventSeq.push(checker); 22 } else { 23 this.unexpectedEventSeq.push(checker); 24 } 25 26 this.invoke = function focusLink_invoke() { 27 var expectedStates = aSelectedAfter ? STATE_FOCUSABLE : 0; 28 var unexpectedStates = 29 (!aSelectedAfter ? STATE_FOCUSABLE : 0) | STATE_FOCUSED; 30 testStates(aID, expectedStates, 0, unexpectedStates, 0); 31 32 this.node.focus(); 33 }; 34 35 this.finalCheck = function focusLink_finalCheck() { 36 var expectedStates = aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0; 37 var unexpectedStates = !aSelectedAfter 38 ? STATE_FOCUSABLE | STATE_FOCUSED 39 : 0; 40 testStates(aID, expectedStates, 0, unexpectedStates, 0); 41 }; 42 43 this.getID = function focusLink_getID() { 44 return "focus hyperlink " + prettyName(aID); 45 }; 46 }