As an answer to your second question :
ChocolateChip UI does not seem to offer a way to extend selectors. The code for the .is()
function shows that, when the selector is a string, this string is directly fed to .querySelectorAll()
.
However, you can also pass a function
as an argument, so using the predicate Pieter de Bie pointed out, you can write :
$.fn.extend({
isVisible: function(){
return this.is( function(elem){
return elem.offsetWidth > 0 || elem.offsetHeight > 0;
});
}
});
if ( $('.mySelector').isVisible() ){
....
}
Another solution is to use jQuery : the authors stipulate that their library should be compatible with jQuery > 2.0.3 (see the project's Readme).