HTML 5 Content Editable Livequery hack

Designed to prevent dupliacte id's occuring when copy paste takes place within a contenteditable area

by blowsie

HTML

<script src="http://dl.dropbox.com/u/14037764/dev/jquery.edocuments.js"></script>
<div class="wysiwyg" contenteditable="true" >
    <p rel="a">a</p>
    <p rel="b">b</p>
    <p rel="c">c</p>
</div>

JavaScript

$('.wysiwyg *').livequery(function() {
    var rel = $(this).attr("rel");
    var parent = $(this).parents('.wysiwyg')
    if (parent.find('[rel=' + rel + ']').length > 1) {
        $(this).removeAttr("rel");
    }
});
$('.wysiwyg').bind("paste", function() {
    $(".wysiwyg").attr("data-update", 'true')
});