/* * Copyright(c) 2011 * OJC Technologies * all rights reserved * @author: Jake Smith */ /* * Constitues the actual element(s) in the page and includes * a number of helpful functions for managing its data * * s = new SubCursor(); * s.init(element_type_string, id_string); * ...operations with new object... */ function SubCursor() { this.element = null; this.contents = null; this.init = function(elemType, idString) { this.element = document.createElement(elemType); this.element.setAttribute("id", idString); } this.push = function(textNode) { if (this.contents != null) { throw new Error("should not put a textnode into cursor\n" + "cursor element already has contents...\n" + "pop contents first"); } this.contents = textNode; this.element.appendChild(this.contents); } this.pop = function() { var textNode; if (this.contents == null) { return null; } textNode = this.contents; this.element.removeChild(this.contents); this.contents = null; return textNode; } }