Giter VIP home page Giter VIP logo

dna.js's Introduction

DNAjs Template Cloner

An Uncomplicated User Interface Library

DNAjs is an easy-to-use UI library for jQuery enabling developers to rapidly build maintainable web applications.

Current release: v0.3.5

1. Bookstore Example

Designate DNA templates with the dna-template class, and put the templates directly into the HTML of your web page.  Use the element's id to indicate the name of the template.  Enclose data fields in double tildes ~~ (a.k.a. DNA strands).

a) HTML for book template

<h1>Featured Books</h1>
<div id=book class=dna-template>
   <div>Title:  <span>~~title~~</span></div>
   <div>Author: <span>~~author~~</span></div>
</div>

Then call the dna.clone() function to insert a copy of the template into the DOM.  The supplied JSON data object will be used to populate the fields of the template.

b) JavaScript call to add book node

dna.clone('book', { title: 'The DOM', author: 'Jan' });

The new element is a DNA clone, and it is appended to the template's parent element (the original template is detached from the DOM and kept for additional cloning).

c) Resulting HTML with DNA clone

<h1>Featured Books</h1>
<div class=book>
   <div>Title:  <span>The DOM</span></div>
   <div>Author: <span>Jan</span></div>
</div>

Clones can alternatively be generated by providing a URL to a REST resource.

d) JavaScript call to load data from a REST call

dna.load('book', 'http://dnajs.org/rest/book/3');

2. Additional Information

dna.js's People

Contributors

dpilafian avatar nikmijic avatar milroc avatar timgluz avatar wanderfound1 avatar

Watchers

James Cloos avatar H Shariati avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.