Basics

〇 was written with three things in mind -
    1. Learning by experience, which I encourage anyone to do
    2. Having a framework doing exactly what I need, and I know how it's being done
    3. finally, having a framework's design as I believe it should

I believe in clear separation between code (Javascript), structure (HTML) and style (CSS). Having this distinction means the code can easily be replaced with having minimum change in the structure and the style, and vice versa. This means the code shouldn't dictate which tag is being used and all relevant style alternation are via classes that have a "js-" prefix.

I tried to be compatible with AirBNB code styling guide as I agree most notes will result with better, more readable code that is less likely to contain bugs.

When possible, methods will return the called object in order to allow chaining, for example: 〇.CSS.add(〇.ELM.myButton,'green').add(〇.ELM.button2,'red')

Although the official name is (It's zero, I pronounce it as "O"), which doesn't normally appear on keyboards, so to make life easier, you may want to use the unofficial name "O" (as in the 15th character in the English alphabet), for example O.ELM.button.onclick();.

Download

Unit Tests

EVT

EVT can be used to listen and to dispatch events. Event-dispatching is a great way to tell other components that something happened.

DOM

DOM is use to make changes in the Document Object Model, which is how the browser keep the page's information. It is important to emphasize that ideally HTML code should not be written within the code. The use of templates is encouraged.

ELM

ELM provides a list of all DOM elements that has an ID, thus providing a quick-list to anything that can be found using document.getElementById().
It also provides a function to query several DOM elements and perform bulk actions on them.

CSS

CSS is used to added and remove classes from DOM elements. Cascading Style Sheets are the way to set element's visual style.
Although it is possible to set style by tag or by id, as the ID should be used by javascript and tags are, obviously used by the HTML. Classes, which suppose to be in the style 'domain', have the 'js-' prefixed automatically to differentiate them from other classes.

AJAX

AJAX is used to communicate with websites, sending and receiving data.

Parameters used

Methods

TPL

TPL is rather simple template-engine, taking after Mustache Templates are HTML elements that
  1. have ID
  2. have the class 'js-template'
When the document is ready all template in the page are automatically subscribed. A change in the HTML element subscribed as template will change the template, thus allowing to have real-time changes in the templates (assuming the element wasn't replaced completely). In addition, TPL provides translation services. It is important to note that TPL provides a string, which then needs to be parsed to a DOM element that will be added to the page.

How to write a template

Methods

VER

VER is a placeholder to provide information regarding 〇. Currently it provides only the version number

Final words

Code,as all Intellectual Property, should be free. Therefore this code is free under MIT License.

If you have any comments, questions and answers, don't hesitate to contact me via GitHub.