Hello everyone make sure to stop by and introduce yourself and do check out our design and programming sections.
Visit the Den and get some free stuff!

You are not connected. Please login or register

What do you look for in a library?

View previous topic View next topic Go down  Message [Page 1 of 1]

1 What do you look for in a library? on Sat Feb 28, 2015 11:21 pm

TheDeveloper

avatar

Moderator
Moderator
Besides dependability, reliability, efficiency and more. What do you all look for in a JavaScript library? I've posted a lot on how ridiculous jQuery is and that I can not stand it for the life of me, and the reason for this is that it's boogered up with functions that half of you will never ever use. So why buy the entire kitchen just for a table set?

So I've been writing a small unique library, it has NO selector function involved so you will need to know how to get elements. By doing this it saves a lot of savvy foreplay with the DOM.

What does my library offer so far?

display : easy function to return or set the display of an element instead of using some ungodly function like .css("display") from jQuery :/


then : some of the functions in my library will set a boolean value and we can use this function to perform actions if it is true or not. Example:

Code:
    var domElements = document.querySelectorAll('*');
    _$(domElements).each(function(i){
        _$(this).contains("text").then(function(){
          // function to run if true
        },function(){
        // function to run if false
        });
    },2 //every other element (evens));

Now this is just a basic example and most likely will not have the function contains. Just needed to show you how then works. If the element at hand has the word text in it then run the first function else run the section function.

each This is a generic each function except we can manipulate the iterator like above.

Code:
_$(domElements).each(function(i){
      //below is three meaning we will have all the odds not including 1 though.
      //if two we will deff have all the evens.
      //default is one, not needed to make it run though.
      //can NOT make it zero   
    },3);

INCORRECT but will run!
Code:
_$(domElements).each(function(i){
      console.log(i);
      //logs 0,1,2,3,4,5,6,7,8
    },0);

I have more work to do to this but as of now it's just a work in progress this is made to be the smallest library needed maybe 15k the largest. So it will have

display
then
each
css
attr

and more... as well as direct functions not used for iterating array of elements such as.

rand = gives random number given from arguments
now = gives the current linux timestamp
inArray = tells if an element is in an array
create = creates a dom element

So tell me what you want to see your library do for you? I'll give you a base starting post

I think that what I seek in a library is something like

Code:
_$(domElements).css({
  background:"#f00",
  color:"#f0f"
});

This function would be great for css styling quickly without any repainting in the DOM.

So use that template above, except take out the bold, and take off my CSS example and write your own how you would want it. If you need just give an example of jQuery since most of you know jQuery, but I'll make it minimalistic.

Thanks for your time guys!

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Share this topic!

URL Direct
BBcode
HTML
What do you look for in a library?

Permissions in this forum:
You cannot reply to topics in this forum