ContentEditable delete experminents
by holf
HTML
<script src="http://www.timdown.co.uk/rangy/rangy-1.2beta2/rangy-core.js"></script>
<div contenteditable="true">
Some text. <a href="#" tabindex="1" onclick="return false" id="jeff" class="highlight-foo">foo</a><a href="#" onclick="return false" class="highlight-foo">foo</a> And some other text.
</div>
<div contenteditable="true"><span contenteditable="false" class="highlight-foo">foo</span><span contenteditable="false" class="highlight-foo">foo</span> And some other text.
</div>
CSS
.highlight-foo {
color: red;
text-decoration: none;
cursor: normal;
}
JavaScript
$(document).ready(function () {
console.log('start');
$('div').keydown(function(event){
console.log(event);
var sel = rangy.getSelection();
console.log(sel._ranges[0].startContainer);
//event.preventDefault();
});
});