(trunk web) #4979 "CSS Issues in Web Client" -- proposed fix. See ticket for more details.

This commit is contained in:
Jordan Lee
2012-07-20 17:37:50 +00:00
parent 6a3c7f34ec
commit 4a344d0656
5 changed files with 53 additions and 39 deletions

View File

@@ -79,9 +79,7 @@ $(document).ready(function() {
});
/**
* "innerHTML = html" is pretty slow in FF. Happily a lot of our innerHTML
* changes are triggered by periodic refreshes on torrents whose state hasn't
* changed since the last update, so even this simple test helps a lot.
* Checks to see if the content actually changed before poking the DOM.
*/
function setInnerHTML(e, html)
{
@@ -98,6 +96,22 @@ function setInnerHTML(e, html)
}
};
function sanitizeText(text)
{
return text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
};
/**
* Many of our text changes are triggered by periodic refreshes
* on torrents whose state hasn't changed since the last update,
* so see if the text actually changed before poking the DOM.
*/
function setTextContent(e, text)
{
if (e && (e.textContent != text))
e.textContent = text;
};
/*
* Given a numerator and denominator, return a ratio string
*/