Created
June 21, 2013 20:47
-
-
Save grssam/5834212 to your computer and use it in GitHub Desktop.
Arguments Overloading FTW
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts any input box on a page to a CSS selector search and suggestion box. | |
* | |
* @constructor | |
* @param {nsIDOMDocument} aContentDocument | |
* The content document which inspector is attached to. | |
* @param {nsiInputElement|String} aInputNode | |
* The input element or the selector for teh input element to which the | |
* panel will be attached and from where search input will be taken. | |
* @param {Object} aOptions | |
* The options provided to the selector. Current available options are: | |
* - TODO | |
* @arguments The following combinations of the above three arguments is possible | |
* - (aContentDocument, aInputNode[, aOptions]) | |
* - (aContentDocument, String[, aOptions]) | |
* - (aInputNode[, aOptions]) | |
* - (String[, aOptions]) | |
*/ | |
function SelectorSearch() { | |
this.searchBox = (typeof arguments[0] == "string") | |
? (this.doc = document).querySelector(arguments[0]) | |
: (!arguments[0].ownerDocument) | |
? ((this.doc = arguments[0]) && typeof arguments[1] == "string") | |
? this.doc.querySelector(arguments[1]) | |
: arguments[1] | |
: (this.doc = arguments[0].ownerDocument, arguments[0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment