Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The two templates involved:
- <script type="text/html" id="js_line_default">
- <div class="lzLine">
- <% for (var i=0; i < line.nodes.length; i++) { %>
- <% var html = line.nodes[i].html(); %>
- <%= html %>
- <% } %>
- </div>
- </script>
- <script type="text/html" id="js_node_default">
- <span class="lzNode">
- <%= node.text %>
- </span>
- </script>
- The two classes involved:
- var lzLine = function(line, element) {
- var that = this;
- this.element = element;
- this.tmpl = "js_line_" + line.tmpl;
- this.nodes = [];
- var nodes = line.nodes;
- for (var i=0; i < nodes.length; i++) {
- var thisNode = new lzNode(nodes[i], this);
- this.nodes.push(thisNode);
- }
- this.html = function() { return tmpl('js_line_default', {'line': line}) };
- }
- var lzNode = function(node, line) {
- var that = this;
- this.tmpl = "js_node_" + node.tmpl;
- this.line = line;
- this.html = function() { return tmpl('js_node_default', {'node': node}) };
- }
Add Comment
Please, Sign In to add comment