Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

rye.create

rye.create is a framework-agnostic zen-coding-like interface for creating DOM elements.

Usage

Just include rye.create.js in your page. It will export itself using requirejs/AMD, to a global $ variable or to window.create if $ is not defined.

Calls to create() return instances of DocumentFragment:

var fragment = $.create('section > p + div.places > li*5 > a[href=#$]')

Resulting in this DOM structure:

<section>
<p></p>
<div class="places">
<li><a href="#1"></a></li>
<li><a href="#2"></a></li>
<li><a href="#3"></a></li>
<li><a href="#4"></a></li>
<li><a href="#5"></a></li>
</div>
</section>

Calling fragment.toHTML() returns an HTML string representing it's contents.

Tests

  • node: run npm test (requires mocha-phantomjs)
  • browser: open rye.create/test/index.html in any browser

About

Zen-coding-like DOM element creation

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages