Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

locationBar

The locationBar class offers simpler access to the location bar and its elements.

Method overview

locationBar(in MozMillController controller);
clear();
contains(in string text);
focus(in object event);
ElemBase getElement(in object spec);
loadURL(in string URL);
toggleAutocompletePopup();
type(in string text);

Attributes

Attribute Type Description
autoCompleteResults
autoCompleteResults
Instance of the autoCompleteResults class to give instant access to the auto-complete results.
controller
MozMillController Controller of the browser window.
urlbar ElemBase ElemBase instance of the location bar node.
value string Current location shown in the location bar.

Methods

locationBar()

Constructor of the locationBar class.

locationBar(
  in MozMillController controller
);
Parameters
controller
MozMillController of the browser window to operate on.

clear()

Focus and clear the location bar content.

clear();
Parameters

None.

contains()

Checks if the location bar contains the specified text.

contains(
  in string text
);
Parameters
text
Expected text, which should be contained inside the location bar.
Return value

true if the text is in the location bar, otherwise false.

focus()

Focus the location bar.

focus(
  in object event
);
Parameters
event
Event which should be used to focus the location bar (click or keyboard shortcut).
event.type (string) Description
"click" Use a mouse click.
"shortcut" Use the keyboard shortcut

getElement()

Retrieves a UI element based on the given spec object.

ElemBase getElement(
  in object spec
);
Parameters
spec
JSON object which specifies the element to retrieve. Use its attributes to specify the exact element. This example shows the correct usage.
spec.type  (string)
spec.subtype (string) spec.value (mixed) Description
"favicon" -
-
Get the favicon element.
"feedButton"
-
-
Get the RSS button element.
"goButton"
-
-
Get the Go Button element.
"historyDropMarker" -
-
Get the drop down element for the auto-complete popup.
"identityBox" -
-
Get the identity box element.
"starButton"
-
-
Get the Star Button element.
"urlBar"
-
-
Get the location bar element.
Return value

ElemBase instance of the requested element which matches the specifications.

loadURL()

Loads the specified URL by typing into the location bar.

loadURL(
  in string URL
);
Parameters
URL
URL to be loaded.

toggleAutocompletePopup()

Toggles between the open and closed state of the auto-complete pop-up.

toggleAutocompletePopup();
Parameters

None.

type()

Types the specified text into the location bar.

type(
  in string text
);
Parameters
text
Text to type into the location bar.

Document Tags and Contributors

 Contributors to this page: Sheppy, Whimboo
 Last updated by: Sheppy,