Side navigation
#3178 closed bug (fixed)
Opened July 23, 2008 03:03PM UTC
Closed October 03, 2010 01:10AM UTC
[Safari][Windows].html() with a text longer than 49934
Reported by: | Joachim | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | core | Version: | 1.2.6 |
Keywords: | safari windows | Cc: | |
Blocked by: | Blocking: |
Description
Hi,
I'm having a issue under Safari for windows version 3.1.2(525.21).
When i'm using thee following code
var data2 = '';
var nb = 49934;
for (cpt =0;cpt <nb;++cpt) {
data2 += 'a';
}
data2 = '<div><div id="website-background">taste</div><div>' + data2 + '</div></div>';
var currentSection = $('#website-background', data2).html();
console.log('Trace : ' + currentSection);
my currentSection var is filled whereas it's null if I use 49935 as nb
Attachments (3)
Change History (7)
Changed July 23, 2008 03:43PM UTC by comment:1
need: | Patch → Test Case |
---|
Changed July 23, 2008 04:43PM UTC by comment:2
I uploaded the file I used to reproduce the error.
I made a mistake in my first error description
The length is 49935 + rhe length of <div><div id="website-background">taste</div><div></div></div>
Changed August 14, 2008 04:26PM UTC by comment:3
It is this line that it is choking on in jQuery.fn.init():
var match = quickExpr.exec( selector );
Process:
1. Calls jQuery.fn.init(html, context);
2. jQuery.fn.init() decides to not do anything on the first time through and try it again as jQuery.fn.init(context).find(selector);
3. It gets to the line mentioned above and fails to match.
That triggers the problem.
It looks like this might be a browser imposed limit to regex string length?
From here we need to:
1. Test this in other versions of Safari Win (who has a different version?).
2. Test this on Safari Mac (all versions supported).
Changed August 14, 2008 04:34PM UTC by comment:4
The total length limit appears to be 49996. Not even divisible by 8!
Changed August 14, 2008 05:00PM UTC by comment:5
It isn't us. https://bugs.webkit.org/show_bug.cgi?id=14873
IE: 67108863
Opera: 2097151
Safari: 49996
FF: ???
Not even in the same ballpark as the others.
Changed May 18, 2009 11:50PM UTC by comment:6
Bug #4665 was related. The Webkit bug is now fixed according to their bug tracker above, but Nathan's patch seems like a good deal (even with a lower limit than 40,000 characters). Not execing a regexp on a monster string has got to be faster.
Changed October 03, 2010 01:10AM UTC by comment:7
resolution: | → fixed |
---|---|
status: | new → closed |
The regexp optimizations applied here should have fixed the performance issue: http://github.com/jquery/jquery/commit/9dc6e0c572b9c809a3a4c123071d96d48a01dd1c#L2L20
Can you please provide a concise test case ?
That is, a small html file with the minimum html/css/js necessary to reproduce the problem.
Also, does it happen for any number equal or higher than 49935 ?