1.0.9 • Published 7 years ago
javascript-extendedjs v1.0.9
ExtendedJS
Small useful library for extending basic functionality of JavaScript. It contains a lot of extend features based on prototypes, different polyfills and helper functions.
Browsers support: Chrome 45+, FireFox 40+, Safari 8+, IE10+, iOS Safari 8+, Android Browser 4.4+.
Since 1.0.8 version the library exists lite version also without some functionality. This version was done specially for using with JavaScript frameworks such as AngularJS.
How to install
You need to include library javascript file from dist directory on your page
<link rel="stylesheet" href="dist/css/DatePickerX.min.css">
<script src="dist/js/DatePickerX.min.js"></script>Library methods and properties
NodeList.prototype.indexOf( Element element ),HTMLCollection.prototype.indexOf( Element element )- Returns element's index in elements collection or-1if element does'n findElement.prototype.matches( String selector )- Polyfill forElement.matchesmethod. Returnstrueif element matches to selector else returnsfalseEventTarget.prototype.addEvent( [String selector], String events, Function handler, [Boolean capture=false] ),Window.prototype.addEvent( [String selector], String events, Function handler, [Boolean capture=false] )- Attaches one or more space-separated event handlers for elementEventTarget.prototype.addEventOne( [String selector], String events, Function handler, [Boolean capture=false] ),Window.prototype.addEventOne( [String selector], String events, Function handler, [Boolean capture=false] )- Attaches one or more space-separated event handlers for element which will be executed only one timeEventTarget.prototype.triggerEvent( String event, [Boolean bubbles=true], [Boolean cancelable=true] )- Triggers event on elementNodeList.prototype.addEvent( [String selector], String events, Function handler, [Boolean capture=false] ),HTMLCollection.prototype.addEvent( [String selector], String events, Function handler, [Boolean capture=false] )- Attaches one or more space-separated event handlers for each element of the node listNodeList.prototype.addEventOne( [String selector], String events, Function handler, [Boolean capture=false] ),HTMLCollection.prototype.addEventOne( [String selector], String events, Function handler, [Boolean capture=false] )- Attaches one or more space-separated event handlers which will be executed only one time for each element of the node listNodeList.prototype.triggerEvent( String event, [Boolean bubbles=true], [Boolean cancelable=true] ),HTMLCollection.prototype.triggerEvent( String event, [Boolean bubbles=true], [Boolean cancelable=true] )- Triggers event for each element of the node listElement.prototype.getElements( Srting selector )- Returns node list of elements selected by selector. Alias ofquerySelectorAllNodeList.prototype.each( Function callback ),HTMLCollection.prototype.each( Function callback )- Executes callback function one time for each element of listElement.prototype.outerHeight- Returns element's height including padding and border sizesElement.prototype.fullOuterHeight- Returns element's height including padding, border and margin sizesElement.prototype.outerWidth- Returns element's width including padding and border sizesElement.prototype.fullOuterWidth- Returns element's width including padding, border and margin sizesDOMTokenList.prototype.contains( String ...className )- Returnstrueif element contains all of passed class names, else returnsfalseDOMTokenList.prototype.containsOne( String ...className )- Returnstrueif element contains at least one of passed class names, else returnsfalseDOMTokenList.prototype.toggle( String className, [Boolean condition] )- Removes class from element and returnsfalse. If class doesn't exist it's added and the returns true. If passed second parameterconditionclass will add if condition istrueor will remove if condition isfalseDOMTokenList.prototype.add( String ...className )- Adds support multiple parameters forclassList.addmethod in IEDOMTokenList.prototype.remove( String ...className )- Adds support multiple parameters forclassList.removemethod in IENodeList.prototype.classList.add( String ...className )- AddsclassList.addmethod into NodeListNodeList.prototype.classList.remove( String ...className )- AddsclassList.removemethod into NodeListNodeList.prototype.classList.toggle( String className, [Boolean condition] )- AddsclassList.togglemethod into NodeListElement.prototype.remove()- Removes current elementNodeList.prototype.remove(),HTMLCollection.prototype.remove()- Removes all elements in collectionElement.prototype.parent( [String selector] )- Returns parent element ornullif it doesn't exist. If passed selector then returns first parent element which matches to selector ornullif such element doesn't existElement.prototype.parents( [String selector] )- Returns list of all parent elements. If passed selector then returns only parent elements which match to selectorElement.prototype.next( [String selector] )- Returns next element ornullif next element doesn't exist. If passed selector then returns first next element which matches to selector ornullif such element doesn't existElement.prototype.nextAll( [String selector] )- Returns list of all next elements. If passed selector then returns only next elements which match to selectorElement.prototype.prev( [String selector] )- Returns previous element ornullif previous element doesn't exist. If passed selector then returns first previous element which matches to selector ornullif such element doesn't existElement.prototype.prevAll( [String selector] )- Returns list of all previous elements. If passed selector then returns only previous elements which match to selectorElement.prototype.childs( [String selector] )- Returns list of all element's children. If passed selector then returns only children which match to selectorNodeList.prototype.filter( String selector ),HTMLCollection.prototype.filter( String selector )- Filters NodeList and returns only elements which match selectorNode.prototype.insertAfter( Node newElement, Node referenceElement)- Inserts the specified node after the reference node as a child of the current nodeNode.prototype.prependChild( Node element )- Inserts the specified node as first child node of the current nodeNode.prototype.insertBeforeCurrent( Node element )- Inserts the specified node before current nodeNode.prototype.insertAfterCurrent( Node element )- Inserts the specified node after current nodeArray.prototype.remove( item )- Removes element from array. Returnstrueif item was found and removedRegExp.escape( String string )- Escapes special characters in passed stringwindow.ExtendedJS.cookies.get( String key )- Returns value of requested cookie or null if such cookie doesn't existwindow.ExtendedJS.cookies.set( String key, value, [Date|Number expires], [String path], [String domain], [Boolean secure=false] )- Sets cookiewindow.ExtendedJS.cookies.delete( String key, [String path], [String domain] )- Deletes cookiewindow.ExtendedJS.cookies.exists( String key )- Returnstrueif cookie exists, else returnsfalsewindow.ExtendedJS.scroll( Number scroll, [Number duration=0], [Function callback] )- Scrolls page to passed position by Y axis with animation durationwindow.ExtendedJS.ajax( [String uri], [Object options] )- Executes AJAX request to uri with optionswindow.ExtendedJS.ajaxDefaults( Object options )- Sets default value for ajax options
Objects window.ExJS and window.exjs are aliases for window.ExtendedJS object.
Lite version of ExtendedJS doesn't contain following:
- objects
window.ExtendedJS,window.ExJSandwindow.exjs - methods
window.ExtendedJS.cookies.get,window.ExtendedJS.cookies.set,window.ExtendedJS.cookies.delete,window.ExtendedJS.cookies.exists,window.ExtendedJS.scroll,window.ExtendedJS.ajaxandwindow.ExtendedJS.ajaxDefaults - properties
Element.prototype.outerHeight,Element.prototype.fullOuterHeight,Element.prototype.outerWidthandElement.prototype.fullOuterWidth
1.0.9
7 years ago