Author: max
Date: 2008-01-03 18:32:28 -0800 (Thu, 03 Jan 2008)
New Revision: 7721
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Log:
Change 20080103-maxcarlson-c by [EMAIL PROTECTED] on 2008-01-03 00:14:38 PST
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix issue with 'div' and 'span' clobbering text size caches
New Features:
Bugs Fixed: LPP-5220 - "span" and "div" (as text) break text-size cache
Technical Reviewer: [EMAIL PROTECTED]
QA Reviewer: promanik
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: Clear contents of lzTextSizeCache div when cache size overflows.
Store measuring div/span as 'lzdiv~~~' + span/div instead of 'span/div'
Tests: See LPP-5220.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
2008-01-03 20:09:35 UTC (rev 7720)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
2008-01-04 02:32:28 UTC (rev 7721)
@@ -1,7 +1,7 @@
/**
* LzTextSprite.js
*
- * @copyright Copyright 2007 Laszlo Systems, Inc. All Rights Reserved.
+ * @copyright Copyright 2007-2008 Laszlo Systems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
* @topic Kernel
@@ -267,15 +267,18 @@
this._styledirty = false;
}
+ var root = document.getElementById('lzTextSizeCache');
+
// Empty the cache when full, but do not reset the counter because
// IE holds onto the object.
if (this._sizecache.counter > 0 && this._sizecache.counter %
this.__sizecacheupperbound == 0) {
this._sizecache = {counter: this._sizecache.counter};
+ if (root) {
+ root.innerHTML = '';
+ }
}
if (this._sizecache[style] == null) this._sizecache[style] = {};
- var root = document.getElementById('lzTextSizeCache');
-
if (! root) {
root = document.createElement('div');
Lz.__setAttr(root, 'id', 'lzTextSizeCache');
@@ -292,7 +295,7 @@
string = string.replace(this.inner_html_strips_newlines_re,
'<br />');
}
var tagname = 'span';
- var mdiv = _textsizecache[tagname];
+ var mdiv = _textsizecache['lzdiv~~~' + tagname];
if (mdiv == null) {
var html = '<' + tagname + ' id="testSpan' +
this._sizecache.counter + '"';
html += ' style="' + style + '">';
@@ -301,7 +304,7 @@
root.insertAdjacentHTML('beforeEnd', html);
mdiv = document.all['testSpan' + this._sizecache.counter];
- _textsizecache[tagname] = mdiv;
+ _textsizecache['lzdiv~~~' + tagname] = mdiv;
}
} else {
if (this.__LzInputDiv == null) {
@@ -310,16 +313,16 @@
}
}
var tagname = this.multiline ? 'div' : 'span';
- var mdiv = _textsizecache[tagname];
+ var mdiv = _textsizecache['lzdiv~~~' + tagname];
if (mdiv == null) {
mdiv = document.createElement(tagname);
Lz.__setAttr(mdiv, 'style', style);
root.appendChild(mdiv);
- _textsizecache[tagname] = mdiv;
+ _textsizecache['lzdiv~~~' + tagname] = mdiv;
}
}
if (this.quirks.ie_leak_prevention) {
- LzTextSprite.prototype._sizedomcache[tagname + style] = mdiv;
+ LzTextSprite.prototype._sizedomcache['lzdiv~~~' + tagname + style]
= mdiv;
}
mdiv.innerHTML = string;
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins