Fixed incorrect regexes in WebPageDump that caused delays and hangs saving certain pages

This commit is contained in:
Dan Stillman 2007-05-21 19:07:33 +00:00
parent c13d98a754
commit 97fb3c7095

View File

@ -544,7 +544,8 @@ var wpdDOMSaver = {
repairInlineCSS : function(aHTMLText)
{
if ( (WPD_CSSSCROLLBUG) && ( aHTMLText.match(/background:/i)) ) {
var re = new RegExp(/style=\"(.*)background:(.*)(repeat scroll 0(?:pt|px|%);)/);
// Regex fixed by Dan for Zotero
var re = new RegExp(/style=\"([^\"]*)background:([^;\"]*)(repeat scroll 0(?:pt|px|%);?)/);
while ( re.exec( aHTMLText ) ) {
var firstPart = RegExp.$1;
var secondPart = RegExp.$2;
@ -553,7 +554,8 @@ var wpdDOMSaver = {
}
}
if ( (WPD_CSSBACKGROUNDPOSITIONBUG) && ( aHTMLText.match(/background-position: /i)) ) {
var re = new RegExp(/style=\"(.*)background-position: 0(?:pt|px|%);/);
// Regex fixed by Dan for Zotero
var re = new RegExp(/style=\"([^\"]*)background-position: 0(?:pt|px|%);/);
while ( re.exec( aHTMLText ) ) {
aHTMLText = aHTMLText.replace(re,"style=\""+RegExp.$1+"background-position: ;");
}