Closed GoogleCodeExporter closed 9 years ago
Hi
This is a very interesting issue. And thanks for the detailed report!
You're right: there's no method to remove elements from ElementCollection when
they are removed from the DOM. I'll have to fix this!
But (there's always a 'but' ;-)
It's not a good idea to call Hyphenator.run() on each ajax-request! This method
does a lot of work.
Use Hyphenator.hyphenate([…])
[http://code.google.com/p/hyphenator/wiki/en_PublicAPI#mixed_Hyphenator.hyphenat
e(mixed_target,_string_lang)] instead. This will not use ElementCollection.
(note: Hyphenator.run() is going to be a singleton in a later release)
Original comment by mathiasn...@gmail.com
on 30 Aug 2013 at 7:45
See example here:
http://hyphenator.googlecode.com/svn/tags/Version%204.1.0/testsuite/test46.html
Further notes:
- use
http://hyphenator.googlecode.com/svn/tags/Version%204.1.0/mergeAndPack.html to
minimize Hyphenator.js and optionally include the patterns
- you are calling 'Hyphenator.reduceHyphenationScope = true;' in
onhyphenationdoencallback what is this? (just wondering)
Original comment by mathiasn...@gmail.com
on 30 Aug 2013 at 7:53
https://code.google.com/p/hyphenator/wiki/en_FAQ#How_to_hyphenate_text_that_has_
been_loaded_with_AJAX?
Does this not contradict the notion of not calling Hyphenator.run() on each
ajax-request?
Original comment by doucetni...@gmail.com
on 2 Sep 2013 at 10:33
Yes somehow.
The example on
https://code.google.com/p/hyphenator/wiki/en_FAQ#How_to_hyphenate_text_that_has_
been_loaded_with_AJAX? just inserts one element. There's no problem with that.
But if you do lots of insertions the issue from above occurs.
Original comment by mathiasn...@gmail.com
on 2 Sep 2013 at 2:20
[deleted comment]
ReduceHyphenationScope was just a bit of a hack to make sure that the
contentselector was only set after the "full page" hyphenator.run ran. Because
if it ran before, it was actually not working on the rest of the page. Timings
and ajax timing stuff huh..
I'm on holiday, my colleague will surely follow up this issue, tnx for picking
it up.
Greets from hawaii
Original comment by slyold...@gmail.com
on 4 Sep 2013 at 6:20
This has not been fixed yet!
The current solution with Observers is not available in older browsers.
Needs better documentation…
Original comment by mathiasn...@gmail.com
on 14 Mar 2014 at 7:46
[deleted comment]
OK, round-up:
- Hyphenator.run() should only be called once. Any subsequent call to
Hyphenator.run() emits a warning.
- Newly added elements have to be hyphenated with
https://code.google.com/p/hyphenator/wiki/en_PublicAPI#mixed_Hyphenator.hyphenat
e(mixed_target,_string_lang)
Doing that there's no memory leak in Hyphenator.js (at least I can't reproduce
it)
Some browsers may leak if the elements are not properly removed from the DOM,
though…
Original comment by mathiasn...@gmail.com
on 17 Oct 2014 at 8:05
Original issue reported on code.google.com by
slyold...@gmail.com
on 28 Aug 2013 at 3:04