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.
You need to include library javascript file from dist
directory on your page
for full version
<script src="dist/ExtendedJS.min.js"></script>
or for lite version
<script src="dist/ExtendedJS.lite.min.js"></script>
NodeList.prototype.indexOf( Element element )
,HTMLCollection.prototype.indexOf( Element element )
- Returns element's index in elements collection or-1
if element does'n findElement.prototype.matches( String selector )
- Polyfill forElement.matches
method. Returnstrue
if element matches to selector else returnsfalse
EventTarget.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 ofquerySelectorAll
NodeList.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 )
- Returnstrue
if element contains all of passed class names, else returnsfalse
DOMTokenList.prototype.containsOne( String ...className )
- Returnstrue
if element contains at least one of passed class names, else returnsfalse
DOMTokenList.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 parametercondition
class will add if condition istrue
or will remove if condition isfalse
DOMTokenList.prototype.add( String ...className )
- Adds support multiple parameters forclassList.add
method in IEDOMTokenList.prototype.remove( String ...className )
- Adds support multiple parameters forclassList.remove
method in IENodeList.prototype.classList.add( String ...className )
- AddsclassList.add
method into NodeListNodeList.prototype.classList.remove( String ...className )
- AddsclassList.remove
method into NodeListNodeList.prototype.classList.toggle( String className, [Boolean condition] )
- AddsclassList.toggle
method into NodeListElement.prototype.remove()
- Removes current elementNodeList.prototype.remove()
,HTMLCollection.prototype.remove()
- Removes all elements in collectionElement.prototype.parent( [String selector] )
- Returns parent element ornull
if it doesn't exist. If passed selector then returns first parent element which matches to selector ornull
if 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 ornull
if next element doesn't exist. If passed selector then returns first next element which matches to selector ornull
if 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 ornull
if previous element doesn't exist. If passed selector then returns first previous element which matches to selector ornull
if 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. Returnstrue
if 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 )
- Returnstrue
if cookie exists, else returnsfalse
window.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.ExJS
andwindow.exjs
- methods
window.ExtendedJS.cookies.get
,window.ExtendedJS.cookies.set
,window.ExtendedJS.cookies.delete
,window.ExtendedJS.cookies.exists
,window.ExtendedJS.scroll
,window.ExtendedJS.ajax
andwindow.ExtendedJS.ajaxDefaults
- properties
Element.prototype.outerHeight
,Element.prototype.fullOuterHeight
,Element.prototype.outerWidth
andElement.prototype.fullOuterWidth