All pastes #62890 Raw Edit

falconair

public javascript v1 · immutable
#62890 ·published 2006-06-07 07:26 UTC
rendered paste body
my code, line 31 is the relevant line:--------------------------------------<html><head>	<title>Table Definition Test</title>	<script src="../prototype_src/dist/prototype.js" type="text/javascript" charset="utf-8"></script>	<script src="../jslibs/event-selectors.js" type="text/javascript" charset="utf-8"></script>	<style>		body {		        font-family: verdana, helvetica, sans-serif;		        font-size: 11px;		        line-height: 14px;		        margin: 0px;		        padding: 0px;		}		p, div, td {		        color: #666;		        font-size: 11px;		        line-height: 14px;		}		.hidden { 			visibility:hidden;			float:left;		}	</style>		<script>		var add=function(clonedObject, destination, optID, optPosition){			//clonedObject.removeClassName("cloneable");			alert(clonedObject);			alert(destination);			new Insertion.Top(destination,clonedObject);		}				var remove=function(objectToRemove){ 			$(objectToRemove).remove();		}				var behaviours={			'#table-container #add:click': function(el){ add($("cloneable-table").cloneNode(true),$("table-container"));}		}	</script></head><body>		<div class="hidden">		<tr class="cloneable" id="cloneable-row">			<td><input name="id" type="checkbox" value="" /></td>			<td><input name="columnName" type="text" style="width:100%;"/></td>			<td><select name="type" style="width:100%;"></select></td>		</tr>				<div class="cloneable container" id="cloneable-table" contentModel="cloneable-row">			<div class="container-header">Enter table name here</div>			<table>				<thead>					<tr>						<th>ID</th> <th>Column Name</th> <th>Type</th>					</tr>				</thead>				<tbody>				</tbody>			</table>		</div>	</div>					<div id="table-container" class="container" contentModel="cloneable-table">		<div class="container-header">			<span>Table Definitions</span> 			<span><img id="add" src="../icons/greyscale_10.gif"></span>			<input name="query" source="table-container"/>		</div>	</div>			</body><script type="text/javascript" charset="utf-8">	EventSelectors.start(behaviours);</script></html>prototype code: line 4 is the relevant line------------------------------------------....Abstract.Insertion.prototype = {  initialize: function(element, content) {    this.element = $(element);    this.content = content.stripScripts();    if (this.adjacency && this.element.insertAdjacentHTML) {      try {        this.element.insertAdjacentHTML(this.adjacency, this.content);      } catch (e) {        var tagName = this.element.tagName.toLowerCase();        if (tagName == 'tbody' || tagName == 'tr') {          this.insertContent(this.contentFromAnonymousTable());        } else {          throw e;        }      }    } else {      this.range = this.element.ownerDocument.createRange();      if (this.initializeRange) this.initializeRange();      this.insertContent([this.range.createContextualFragment(this.content)]);    }    setTimeout(function() {content.evalScripts()}, 10);  },  contentFromAnonymousTable: function() {    var div = document.createElement('div');    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';    return $A(div.childNodes[0].childNodes[0].childNodes);  }}....