The error must be coming from another method that retrieves
'element'. I have not really tried to debug this. Wondering if
anyone else has had this problem, and how they remedied it.
The HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="
http://localhost:4402/author/js/
prototype.js"></script>
<script type="text/javascript" src="
http://localhost:4402/author/js/
effects.js"></script>
<script type="text/javascript" src="
http://localhost:4402/author/js/
controls.js"></script>
<style type="text/css">
div.autocomplete {
position:absolute;
width:250px;
background-color:white;
border:1px solid #888;
margin:0;
padding:0;
}
div.autocomplete ul {
list-style-type:none;
margin:0;
padding:0;
}
div.autocomplete ul li.selected { background-color: #ffb;}
div.autocomplete ul li {
list-style-type:none;
display:block;
margin:0;
padding:2px;
height:32px;
cursor:pointer;
}
</style>
</head>
<body>
<label for="input">Autotext:</label>
<input type="text" id="input" name="input" size="15" />
<div id="results" class="autocomplete" style="display: none;
position:relative;"></div>
<script type="text/javascript">
var txtid = 'input';
var divid = 'results';
var server = '
http://localhost:8080/ewcmtestbed/autocomplete';
new Ajax.Autocompleter(txtid, divid, server, { tokens: ','});
</script>
</body>
</html>
The error:
In prototype.js
element is null
The method:
cleanWhitespace: function(element) {
element = $(element);
var node = element.firstChild;
while (node) {
var nextNode = node.nextSibling;
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
element.removeChild(node);
node = nextNode;
}
return element;
},