This file contains hidden or 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
// | |
// Code taken from http://youmightnotneedjquery.com/ | |
// THEN, edited to es6 and altered to work with ESlint | |
// | |
// 1. extend objects the same as jQuery | |
// 2. passes eslint AirBnB | |
// 3. provides you with isTypeOf and isObject methods | |
// 4. Please remember to use Object.assign instead if object 1 deep | |
// You lucky people. | |
// |
This file contains hidden or 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
// NOTE: This also uses another function created called findLite | |
// https://gist.github.com/PocketNinjaDesign/b7808126e97f319929674d09e4ac85d1 | |
/** | |
* @example | |
* // returns jqlite object using class | |
* $.fn.findFromAjax(response.data, '.some-class-name'); | |
* @example | |
* // returns jqlite object using id | |
* $.fn.findFromAjax(response.data, '.someId'); |
This file contains hidden or 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
// For when you just want a quick hack to find things using jqlite | |
// findVeryVeryLite :-P | |
/** | |
* @param {string} selector any 'element', '.class' or '#id' | |
* @returns {object} jqlite objects | |
* @description Finds 1 or many elements within a single element | |
*/ | |
$.fn.findLite = function(selector) { | |
return $(this[0].querySelectorAll(selector)); |