Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (65 sloc) 2.06 KB
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>weld - examples</title>
<script type="text/javascript" src="lib/weld.js"></script>
<script type="text/javascript">
window.onload = function() {
var getWeld = function(){
// We eat our own dogfood.
// This entire page is rendered via weld.
var page = {
pageTitle : "Weld examples",
description : "Below is a list of examples",
dogfood : "This page was rendered with weld",
example : [
title : 'Render an object into some elements',
markup : '<div id="example-1">\n <h1 class="title">Bunk data</h1>\n <p class="body">Bunk description</p>\n</div>',
data : '{"title" : "My first blog post!", "body" : "Hello world!"}',
code : 'weld(document.getElementById("example-1"), data)'
weld(document.body, page);
var actionElements = document.getElementsByClassName('action'),
currentActionElement = actionElements.length;
// setup the onclick for all of the "weld!" links
while(currentActionElement--) {
actionElements[currentActionElement].onclick = function(e) {
<h1 class="pageTitle">Random title</h1>
<p class="description">
This is a description about this page..
<p class="dogfood">
here is some dogfood
<div class="example">
<h1 class="title">Example title</h1>
<div clas="markupContainer">
<pre class="markup"></pre>
<div class="dataContainer">
<pre class="data"></pre>
<div class="codeContainer">
<pre class="code"></pre>
<div class="resultContainer">
<p>Result (<a href="#" class="action">weld!</a>)</p>
<pre class="result"></pre>
Jump to Line
Something went wrong with that request. Please try again.