Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If content of element is replaced, a second .ellipsis() fails due to existing/wrong .data('jqae') #22

Open
ghost opened this issue May 4, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented May 4, 2013

If the content of an 'ellipsed' element is replaced, a second .ellipsis() on the element fails due to existing/wrong .data('jqae') internal storage of autoellipsis.

Scenario:

  1. div.mydiv gets some content via .html( "lorem ipsum 1 long longer longest etc." )
  2. $( '.mydiv' ).ellipsis() is called
  3. content is 'ellipsed' ok, fine
  4. div.mydiv is cleared with $( '.mydiv' ).empty()
  5. div.mydiv gets new content via .html( "lorem ipsum 2 even longer or shorter or etc." )
  6. $( '.mydiv' ).ellipsis() is called
  7. content is not 'ellipsed', not as expected

The problem is that .empty() does (of course) not clear the .data( 'jqae' ) of div.mydiv and so the second call to $( '.mydiv' ).ellipsis() finds it and draws wrong conclusions.

Workaround, clear the .data('jqae') internal storage of autoellipsis before second call:

  1. $( '.mydiv' ).data( 'jqae', null )
  2. $( '.mydiv' ).ellipsis() is called
  3. content is 'ellipsed' ok, fine

Thanks for this great plugin.

@matths
Copy link

matths commented Feb 5, 2016

Isn't this a Duplicate of #18, and still not fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant