You can't do trivial replacement because you're modifying the DOM in
certain places, which invalidates your reference. You'll have to recreate
it after every modification that affects it (not it's children, though).
On Apr 16, 2014 1:51 PM, "Shahar Or" <notifications@github.com> wrote:

> In src/wymeditor/editor/base.js:
>
> > +        pToRemove,
> > +        liContentBeforeP,
> > +        liContentAfterP,
> > +        parentList,
> > +        parentLiIndex,
> > +        threeLis = '<li></li><li data-wym-caret=""></li><li></li>';
> > +
> > +
> > +    // Browsers can sometimes create `p` elements within `li` elements. Issue 430.
> > +
> > +    // If it is the right kind of 'p'
> > +    if (currentNode !== null &&
> > +        currentNode.tagName.toLowerCase() === 'p' &&
> > +        currentNode.parentNode.tagName.toLowerCase() === 'li') {
> > +
> > +        pToRemove = currentNode;
>
> I tried doing that but trivial replacement of jQuery(currentNode) with
> $currentNode plus adding a variable $currentNode = jQuery(currentNode) at
> the top doesn't seem to be enough. It makes some tests fail. I didn't dig
> in because I thought that you probably tell me why that is immediately.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/wymeditor/wymeditor/pull/486/files#r11697224>
> .
>