xles / hyphenator

Automatically exported from code.google.com/p/hyphenator
GNU General Public License v3.0
0 stars 0 forks source link

Hyphenator crashing IE8 but fine in IE7 #157

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
as one would expect I'm experiencing performance regression in IE8 and IE7 
compared to modern browsers.

The weird thing is that IE7 seems to be handling things fine when IE8 is taking 
5 times longer to hyphenate and crashes when it finds more than 8 headlines to 
hyphenate.

I've already implemented performance tweaks to moderate load in IE8 and below 
but it still keeps crashing. IE8 uses a full cpu core for >5 seconds on less 
than 10 headlines while IE7 easily does the same in under 2 seconds.

I am using IETester, could that be the problem?

This is the invocation and configuration Im using:

(function ($) {

/**
 * @code
 * IE 8 and below are not fast enough to handle all the hypenation we need done so
 * we keep hyphenation to a minimum
 */
if ($.browser.msie && $.browser.version < "8.99") {
  var hyphThis = '.featured-pane h2:not(.clarinHyphenate-processed), .node-type-showcase .nodetitle:not(.clarinHyphenate-processed)';
} else {
  var hyphThis = '.featured-pane:not(.clarinHyphenate-processed), .nodetitle:not(.clarinHyphenate-processed), .view-events-simple li:not(.clarinHyphenate-processed), .location:not(.clarinHyphenate-processed)';
}

Drupal.behaviors.clarinHyphenate = function (context) {
  $(hyphThis, context).addClass('clarinHyphenate-processed').each(function () {
    Hyphenator.config({
      classname: 'clarinHyphenate-processed',
      minwordlength : 2,
      // This means lang packages don't have to be downloaded #winning:
      useCSS3hyphenation: true
    });
    Hyphenator.run();
  });
};

})(jQuery);

Original issue reported on code.google.com by jurriaan...@hotmail.com on 12 Feb 2012 at 6:30

GoogleCodeExporter commented 9 years ago
IETester can give you a first impression but for real testing (specially for 
javascript) you'll need a VM with a real IE.

I'm not understanding what you are trying to do with your code:
  1. You get the 'hyphThis'-elements and add a class to them;
  2. for each element you call Hyphenator.config() and Hyphenator.run();
Is that right?

1. looks very heavy (I haven't tested it)
2. Don't do that! Hyphenator.run() should be called only once. If not it 
processes the whole site each time.
If you have to call it for each element, see 
http://code.google.com/p/hyphenator/wiki/en_PublicAPI#mixed_Hyphenator.hyphenate
(mixed_target,_string_lang)

Original comment by mathiasn...@gmail.com on 29 Apr 2012 at 10:05