jCore - minimalist jQuery fork

jCore - a faster jQuery

jCore is a JavaScript library which minimizes time needed to code most common things, like attaching events to DOM elements, performing AJAX calls, animating elements and so on.

jCore API is based on jQuery but the library was written from scratch. On most websites you can simply replace jQuery with jCore and everything will work as before- but faster.

Why is jCore so small compared to jQuery? It makes use of HTML5 and CSS3 features just wrapping them in a nice, handy API. Keep in mind that not all of jQuery features are available in jCore- just the most popular and important.

Additional features are available in form of plug-ins, number of which constantly increases.

Supported browsers

What about older browsers?

Do you really need to support browsers which are over 6 years old? Just say NO to time travallers from the past and offer them a non-JavaScript fallback or, better, a message saying they really should update their dinosaur.

jCore vs. jQuery

  jCore 1.0 jQuery 1.11.2 jQuery 2.1.3
Size 7.6 kB 277 kB 241 kB
Minified size 4.6 kB 93.6 kB 82.3 kB
Gzipped size 1.6 kB 31.5 kB 27.9 kB
animate()
(in jcore.animate)
Using smooth CSS animations Using shaky JS setInterval() Using shaky JS setInterval()
Works with major browsers + + +
License MIT MIT MIT
Cost Free Free Free
  Download
   

jCore API

The constructors

$()

jCore $(string selector)
Returns an instance of the jCore class which holds a collection of DOM elements matching the given CSS selector
jCore $(DOMElement element)
Returns an instance of the jCore class which holds the given DOMelement

Instance methods

Instance methods (or simply: methods) can only be invoked on an instance of the jCore class, which means every method has to be invoked this way:

$(selector).method()

each()

jCore each(function callback)
Iterates through every element in the collection of matched elements invoking callback on every one of them

on()

jCore on(string events, function callback)
Attaches callback function to one or more events of the matched elements. Events should be space-separated

css()

jCore css(string property, string value)
Sets inline CSS for the matched elements
string css(string property)
Returns CSS property of the first matched element

html()

jCore html(string HTML)
Sets inner HTML of the matched elements to HTML
string html()
Returns inner HTML of the first matched element

attr()

jCore attr(string attribute, string value)
Sets attribute attribute of the matched elements to value
string attr(string attribute)
Returns attribute attribute of the first matched element

val()

jCore val(string value)
Sets value of the matched elements to value. It only works with <form> elements: input, select, textarea
string val()
Returns value of the first matched element

toggleClass()

jCore toggleClass(string class)
Removes class class from matched elements when they have it. Adds the class class to those that don't have it

addClass()

jCore addClass(string class)
Adds the class class to the matched elements

removeClass()

jCore removeClass(string class)
Removes the class class from the matched elements

hasClass()

boolean hasClass(string class)
Tests if the first matched element has class class

remove()

jCore remove()
Removes matched elements

replaceWith()

jCore $(DOMElement element)
Replaces every element from the set of matched elements with element
jCore $(jCore element)
Replaces every element from the set of matched elements with element
jCore $(string HTML)
Replaces every element from the set of matched elements with HTML

show()

jCore show()
Shows the matched elements by setting display:block to all of them.

hide()

jCore hide()
Hides the matched elements by setting display:none to all of them.

toggle()

jCore toggle()
Shows hidden elements from the set of matched elements, hides visible elements

get()

DOMElement get(integer index)
Returns DOM element number index from the set of matched elements

parent()

jCore parent()
Returns parent of the first matched element

next()

jCore next()
Returns element which comes after the first matched element in the DOM tree

prev()

jCore prev()
Returns element which comes before the first matched element in the DOM tree

offset()

array offset()
Returns array containing the first element's bounds

find()

jCore find(string selector)
Returns children of the first matched element that match CSS selector selector

children()

jCore children(string selector)
Returns direct children of the first matched element that match CSS selector selector

text()

jCore text(string text)
Sets inner HTML of the matched elements to plain text text. If text contains any HTML it will be stripped
string text()
Returns the inner HTML as plain text of the first matched element

clone()

jCore clone()
Creates a copy in memory (outside the DOM tree) of the first matched element

append()

jCore append(string HTML)
Inserts HTML before the end of every matched element

is()

Boolean is(string CSSSelector)
Checks if the first element in the set of matched elements matches given CSSSelector

parents()

jCore parents(string CSSSelector)
Returns parent elements matching given CSSSelector
jCore parents()
Returns parent elements

eq()

jCore eq(integer index)
Returns element with offset index from the set of matched elements

lt()

jCore $(string selector)
Returns element with offset index or smaller from the set of matched elements

gt()

jCore $(string selector)
Returns element with offset index or bigger from the set of matched elements

Static methods

Static methods can only be invoked on the jCore class, which means every method has to be invoked this way:

	$.staticMethod()
	

$.ajax

jCore $.ajax(boolean isGET, string url, string queryString, function successCallback)
Performs an asynchronous AJAX request of type GET or POST depending on value of isGET to the given url, sending queryString and calling successCallback on success

$.post

jCore $.post(string url)
Performs an asynchronous AJAX POST request to the given url
jCore $.post(string url, function successCallback)
Performs an asynchronous AJAX POST request to the given url and calling successCallback on success
jCore $.post(string url, string queryString, function successCallback)
Performs an asynchronous AJAX POST request to the given url, sending queryString and calling successCallback on success

$.get

jCore $.get(string url)
Performs an asynchronous AJAX GET request to the given url
jCore $.get(string url, function successCallback)
Performs an asynchronous AJAX GET request to the given url and calling successCallback on success
jCore $.get(string url, string queryString, function successCallback)
Performs an asynchronous AJAX GET request to the given url, sending queryString and calling successCallback on success

$.prefix

string $.prefix(string feature)
Returns a prefix required for a given feature or false if this feature is not supported. For example to test if a web browser supports CSS animations try: $.prefix('animation')

Writing custom plug-ins

How to write jCore plug-ins? Well, it's very simple. Let's begin with..

Static plug-in

A static plug-in does not work on DOM elements but instead does, for example, AJAX calls.
	$.myPlugin = function(parameter1, parameter2)
	{
		//put the code here
	}
	

Instance plug-in

Am instance plug-in works on DOM elements
	$$.myPlugin = function(parameter1, parameter2)
	{
		//put the code here
		//this = array of matched DOM elements
		//this[0] = first matched DOM element
		//this.length = number of matched DOM elements
	}
	

jQuery to jCore conversion guide

Not every jQuery feature is available in jCore. Below is a simple list pointing out the differences
jQuery jCore Information
$().bind('click', function() $().on('click', function() If you really need these
methods you can download
jCore.events
$().blur(function() $().on('blur', function()
$().change(function() $().on('change', function()
$().click(function() $().on('click', function()
$().dblclick(function() $().on('dblclick', function()
$().error(function() $().on('error', function()
$().focus(function() $().on('focus', function()
$().focusin(function() $().on('focusin', function()
$().focusout(function() $().on('focusout', function()
$().hover(function() $().on('hover', function()
$().keydown(function() $().on('keydown', function()
$().keypress(function() $().on('keypress', function()
$().keyup(function() $().on('keyup', function()
$().load(function() $().on('load', function()
$().mousedown(function() $().on('mousedown', function()
$().mouseenter(function() $().on('mouseenter', function()
$().mouseleave(function() $().on('mouseleave', function()
$().mousemove(function() $().on('mousemove', function()
$().mouseout(function() $().on('mouseout', function()
$().mouseover(function() $().on('mouseover', function()
$().mouseup(function() $().on('mouseup', function()
$().ready(function() $().on('ready', function()
$().resize(function() $().on('resize', function()
$().scroll(function() $().on('scroll', function()
$().select(function() $().on('select', function()
$().submit(function() $().on('submit', function()
$().unload(function() $().on('unload', function()

Download

jCore 1.0 beta
jCore 1.0 beta + Plug-ins

Unimified code (aka the source)

Please do not reditribute jCore in an unminized version as the biggest advantage of the library is its SMALL size.

Github reposistory

Custom build

Select components to download

  Size Select
jCore beta 4.69 kB
jCore.Animate 1.02 kB
jCore.Browsers 0.96 kB
jCore.Cookies 0.31 kB
jCore.Visible 0.10 kB
jCore.Counter 0.26 kB
jCore.Editor * 5.48 kB

* For jCore.Editor please download not only JS but also CSS and PNG:

jCore plug-ins

jcore.animate, 1.02 kB

animate()

jCore animate(object CSS, integer milliseconds)
Animates a transition of style attributes of the matched elements from current state to CSS in milliseconds time

fadeIn()

jCore fadeIn(integer milliseconds)
Animates elements' transparency to fully opaque, hence the matched elements become fully visible in milliseconds time

fadeOut()

jCore fadeOut(integer milliseconds)
Animates elements' transparency to full transparency, hence the matched elements become invisible in milliseconds time

jcore.cookies, 0.31 kB

$.cookie()

boolean visible()
Returns true if the first matched element is visible, otherwise returns false

jcore.visible, 0.10 kB

$().visible()

boolean visible()
Returns true if the first matched element is visible, otherwise returns false

jcore.browsers, 0.96 kB

$.isWebkit

boolean $.isWebkit()
Returns true if a web browser is Webkit-based, eg. Google Chrome 8+, Safari 6+, Opera 15+

$.isMozilla

boolean $.isMozilla()
Returns true if a web browser is Gecko-based (1.9.2+) eg. Mozilla Firefox 3.6+, Thunderbird 3.1+, Firefox Mobile 1.0+ (Fennec)

$.isOpera

boolean $.isOpera()
Returns true if a web browser is Opera 6+

$.isIE()

boolean $.isIE()
Returns true if a web browser is Internet Explorer 8+

$.isMobile

boolean $.isMobile()
Returns true if a web browser is running on a mobile (tablet, phone)

$.isOperaMini

boolean $.isOperaMini()
Returns true if a web browser is running under Opera Mini

$.isOperaMobile

boolean $.isOperaMobile()
Returns true if a web browser is running under Opera Mobile

$.isAndroid

boolean $.isAndroid()
Returns true if a web browser is running under Android OS

$.isBlackBerry

boolean $.isBlackBerry()
Returns true if a web browser is running under BlackBerry OS

$.isiOS

boolean $.isiOS()
Returns true if a web browser is running under iOS

$.isWindowsPhone

boolean $.isWindowsPhone()
Returns true if a web browser is running under Windows Phone OS

$.isWindows

boolean $.isWindows()
Returns true if a web browser is running under Windows OS

$.isMac

boolean $.isMac()
Returns true if a web browser is running under MacOS

$.isUnix

boolean $.isUnix()
Returns true if a web browser is running under Unix OS

$.isLinux

boolean $.isLinux()
Returns true if a web browser is running under Linux OS

jcore.counter, 0.26 kB

$().counter()

jCore counter(integer from, integer to, integer milliseconds)
Animates the matched elements by changing their text() to values in range from> - to in milliseconds time

jcore.aniscroll, 0.33 kB

$().aniscroll()

jCore aniscroll(integer offset, integer milliseconds)
Animates the matched elements by changing their text() to values in range from> - to in milliseconds time

jcore.events, 0.30 kB

$().click()

jCore click(function callback)
Alias to $().on('click');

$().blur()

jCore blur(function callback)
Alias to $().on('blur');

$().change()

jCore change(function callback)
Alias to $().on('change');

$().dblclick()

jCore dblclick(function callback)
Alias to $().on('dblclick');

$().error()

jCore error(function callback)
Alias to $().on('error');

$().focus()

jCore focus(function callback)
Alias to $().on('focus');

$().focusin()

jCore focusin(function callback)
Alias to $().on('focusin');

$().focusout()

jCore focusout(function callback)
Alias to $().on('focusout');

$().hover()

jCore hover(function callback)
Alias to $().on('hover');

$().keydown()

jCore keydown(function callback)
Alias to $().on('keydown');

$().keypress()

jCore keypress(function callback)
Alias to $().on('keypress');

$().keyup()

jCore keyup(function callback)
Alias to $().on('keyup');

$().load()

jCore load(function callback)
Alias to $().on('load');

$().mousedown()

jCore mousedown(function callback)
Alias to $().on('mousedown');

$().mouseenter()

jCore mouseenter(function callback)
Alias to $().on('mouseenter');

$().mouseleave()

jCore mouseleave(function callback)
Alias to $().on('mouseleave');

$().mousemove()

jCore mousemove(function callback)
Alias to $().on('mousemove');

$().mouseout()

jCore mouseout(function callback)
Alias to $().on('mouseout');

$().mouseover()

jCore mouseover(function callback)
Alias to $().on('mouseover');

$().mouseup()

jCore mouseup(function callback)
Alias to $().on('mouseup');

$().ready()

jCore ready(function callback)
Alias to $().on('ready');

$().resize()

jCore resize(function callback)
Alias to $().on('resize');

$().scroll()

jCore scroll(function callback)
Alias to $().on('scroll');

$().select()

jCore select(function callback)
Alias to $().on('select');

$().submit()

jCore submit(function callback)
Alias to $().on('submit');

$().unload()

jCore unload(function callback)
Alias to $().on('unload');

jcore.editor, 5.48 kB

$().editor()

jCore editor()
Creates an instance of jCore Editor. The first matched element needs to be a textarea
jCore editor({buttons: 'bold,image,|,save,open'})
Creates an instance of jCore Editor. The first matched element needs to be a textarea. Only given buttons will be placed in the toolbar. You need to comma-separate them. Supported buttons are:

new,open,save,bold,italic,strikethrough,underline,subscript,superscript,font,color,size, justifyleft,justifycenter,justifyright,justifyfull,outdent,indent,removeformat,undo,redo, insertunorderedlist,insertorderedlist,inserthorizontalrule,createlink,unlink,image,cut, copy,paste,pasteplain,print,html

You can use | as a separator
jCore editor('remove')
Creates an instance of jCore Editor. The first matched element needs to be a jCore Editor
jCore editor('html')
Returns HTML content of the first matched jCore Editor

Playground

If you like this project please consider a small donation. It will keep the project alive and growing.
Thanks in advance!
Enter amount: $ and click:

Examples

Animated counter - increasing starts when visitor scroll to it

Animated curtain

WYSIWYG editor

Contact us / Request a feature

Need help? Have a suggestion? Found a bug? Don't hesitate to contact us.

Don't forget to type in your e-mail address if you need an answer or you are a donor and requests a feature (donors' requests are more likely to be implemented.

Thank you for contacting us. If your message requires an answer we'll respond as soon as possible


*

License

jCore library and jCore plug-ins

jCore library and the plug-ins are released under the terms of the MIT license.

In other words you are free to use jCore and jCore plug-ins in any project (even commercial projects) as long as the copyright header is left intact.

Demos in Playground

The Playground demos are released under the terms of CC0. It allows you to use the code in any manner you want, without any copyright headers, notices or any other attribution.

The website

The design, layout and texts are not licensed for use and may not be used on any site, personal or commercial, without prior written consent from us.

Copyright © 2015 by jco.re