Author: ptw
Date: 2006-11-14 08:56:31 -0800 (Tue, 14 Nov 2006)
New Revision: 2521
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Log:
Change 20061113-ptw-w by [EMAIL PROTECTED] on 2006-11-13 16:59:21 EST
in /Users/ptw/OpenLaszlo/legals-2/WEB-INF/lps/lfc
Summary: Work around yet another IE quirk
Bugs Fixed:
LPP-2981: Multiline text with newlines is broken again in IE 6
Technical Reviewer: max (Message-ID: <[EMAIL PROTECTED]>)
QA Reviewer: mamye (pending)
Doc Reviewer: n/a
Details:
Add a new IE quirk. I don't know how the previous way we did this
worked. I reverted the code to the previous version and it still
failed in IE. So now I set the div style to pre if it is
multi-line and has embedded newlines. Because of an IE quirk, you
have to set the text content using innerText, rather than
innerHTML.
Tests:
Loaded LZPIX in Safari, FireFox, and IE. Observed that version
info block was multi-line, as expected.
Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
2006-11-14 16:53:32 UTC (rev 2520)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
2006-11-14 16:56:31 UTC (rev 2521)
@@ -146,6 +146,7 @@
,invisible_parent_image_sizing_fix: false
,disable_opacity: false
,emulate_flash_font_metrics: true
+ ,ie_inner_html_strips_newlines: false
}
LzSprite.prototype.quirks.__BrowserDetect.init();
@@ -173,6 +174,9 @@
// workaround for IE refusing to respect divs with small heights when
// no image is attached
LzSprite.prototype.quirks['fix_ie_background_height'] = true;
+
+ // workaround for IE stripping newlines from innerHTML
+ LzSprite.prototype.quirks['ie_inner_html_strips_newlines'] = true;
}
if (LzSprite.prototype.quirks.__BrowserDetect.browser == 'Safari') {
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
2006-11-14 16:53:32 UTC (rev 2520)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
2006-11-14 16:56:31 UTC (rev 2521)
@@ -78,12 +78,18 @@
// For SWF compatibility, we preserve newlines in text. We'd
// like to use pre-line, but that appears not to work for any
// browser. As a compromise, if the content contains newlines, we
- // use 'pre' The alternative would be to String.replace all
- // newlines with <br />.
+ // use 'pre' The alternative would be `t.replace(RegExp('$',
+ // 'mg'), '<br />')`.
// TODO: [2006-10-02 ptw] Use 'pre-line' when supported.
- this.__LZdiv.innerHTML = (t && this.multiline && (t.indexOf("\n") >= 0)) ?
- ('<span style="white-space: pre">' + t + '</span>') :
- t;
+ if (this.multiline && t && (t.indexOf("\n") >= 0)) {
+ this.__LZdiv.style['whiteSpace'] = 'pre';
+ } else {
+ this.__LZdiv.style['whiteSpace'] = 'normal';
+ }
+ this.__LZdiv.innerHTML = t;
+ if (LzSprite.prototype.quirks['ie_inner_html_strips_newlines']) {
+ this.__LZdiv.innerText = t;
+ }
// reset the size cache
if (this._textsizecache) this._textsizecache = {};
@@ -95,7 +101,7 @@
this.multiline = (m == true);
if (m) {
// TODO: [2006-10-02 ptw] Use 'pre-line' when supported and
- // remove the span/pre hack in setText.
+ // remove the pre/normal hack in setText.
this.__LZdiv.style['whiteSpace'] = 'normal';
this.__LZdiv.style['overflow'] = 'visible';
} else {
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins