/* * Copyright(c) 2011 * OJC Technologies * all rights reserved * @author: Jake Smith */ /* * Constitues the actual element(s) in the page * * s = new PhysicalCursor(element_type_string, id_string, color_string); * ...operations with new object... * [s.push(node); var n = s.pop();] */ function PhysicalCursor(elemType, idString, colorString) { this.contents = null; this.element = document.createElement(elemType); this.element.setAttribute("id", idString); this.element.setAttribute("style", "background-color: " + colorString); this.pushErrorMsg = "should not push a textnode into cursor\n" + "cursor element already has contents...\n" + "pop contents first?"; this.push = function(node) { if (this.contents != null) { throw new Error(this.pushErrorMsg); } this.contents = node; this.element.appendChild(this.contents); } this.pop = function() { var node; if (this.contents != null) { node = this.contents; this.element.removeChild(this.contents); this.contents = null; } return node; } this.invisible = function() { var rect; rect = this.element.getBoundingClientRect(); return (rect.width == 0) ? true : false; } //-----------------------// // "Private" functions // //-----------------------// // N/A } // PhysicalCursor(elemType, idString)