avoid generation of multiple divs

This commit is contained in:
Jishnu Mohan 2012-11-18 14:20:24 +05:30
parent e8f05c0df2
commit 60e63ff28f
2 changed files with 3 additions and 3 deletions

View File

@ -208,8 +208,7 @@ haste.prototype.addLineNumbers = function(data) {
}; };
haste.prototype.getCharacterWidth = function() { haste.prototype.getCharacterWidth = function() {
var $div = $("<div></div>"); var $div = $("#sandbox");
$("body").append($div);
$div.html('a'); $div.html('a');
$div.css('width','auto') $div.css('width','auto')
.css('font', $("code").css('font')) .css('font', $("code").css('font'))

View File

@ -63,7 +63,8 @@
<div id="linenos"></div> <div id="linenos"></div>
<pre id="box" style="display:none;" tabindex="0"><code></code></pre> <pre id="box" style="display:none;" tabindex="0"><code></code></pre>
<textarea spellcheck="false" style="display:none;"></textarea> <textarea spellcheck="false" style="display:none;"></textarea>
<div id="sandbox">
</div>
</body> </body>
</html> </html>