Update Title
updateTitle: function(title) { document.title = title; }
TextSnippets > winton > dom
2740 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
Winton Welsh http://stu.dicio.us
updateTitle: function(title) { document.title = title; }
getHTML: function(node) { var div = document.createElement('DIV'); div.appendChild(node.cloneNode(true)); return div.innerHTML; }
childOfID: function(element, id, isClass) { element = $(element); do { if (isClass && element.hasClassName(id)) return element; if (!isClass && element.id == id) return element; } while (element = $(element.parentNode)); return false; }
attachElement: function(p) { this.el[p] = $$(this.elements[p]); if (this.el[p].length == 1) this.el[p] = this.el[p][0]; }, attachElements: function() { this.el = {}; for (x in this.elements) this.attachElement(x); }, clearElements: function() { for (x in this.el) this.el[x] = null; }