| 1 |
/** |
| 2 |
* Common functions that are used in TablePress JS. |
| 3 |
* |
| 4 |
* @package TablePress |
| 5 |
* @subpackage Views JavaScript |
| 6 |
* @author Tobias Bäthge |
| 7 |
* @since 2.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
/** |
| 11 |
* Alias for document.getElementById and document.querySelectorAll, depending on the first character of the passed selector string. Resembles jQuery. |
| 12 |
* |
| 13 |
* @param {string} selector Selector string. If it starts with #, a single ID is selected, all matching selectors otherwise. |
| 14 |
* @return {Element|NodeList} A single DOM Element or a DOM NodeList matching the selector. |
| 15 |
*/ |
| 16 |
export const $ = ( selector ) => ( '#' === selector[0] ? document.getElementById( selector.slice( 1 ) ) : document.querySelectorAll( selector ) ); |
| 17 |
|