In this case, where you’re just checking if a certain element exists, <code>$(‘div#year’).length</code> can be shortened to <code>$(‘div#year’)0</code>.
I was also wondering why you’re using the following code:
<pre><code>
// load in CSS for the logger
var style = document.createElement(‘link’);
style.type = “text/css”;
style.rel = “stylesheet”;
style.href = sleuth.test_page.console_css_location;
document.getElementsByTagName(‘head’)0.appendChild(style);
</code></pre>
(Honest question; maybe there are performance implications I’m not aware of.)
Thanks for this great article. Definitely some food for thought here!
(P.S. This comment looks mangled in the comment preview even though I’m using perfectly valid Textile formatting. I’m confused, so submitting anyway ;) Please fix if necessary! Thanks.)
In this case, where you’re just checking if a certain element exists, <code>$(‘div#year’).length</code> can be shortened to <code>$(‘div#year’)0</code>.
I was also wondering why you’re using the following code:
<pre><code> // load in CSS for the logger var style = document.createElement(‘link’); style.type = “text/css”; style.rel = “stylesheet”; style.href = sleuth.test_page.console_css_location; document.getElementsByTagName(‘head’)0.appendChild(style);
</code></pre>
When you could just do something like:
<pre><code>$(‘head’).append(’<link href=”’ + sleuth.test_page.console_css_location + ‘” rel=“stylesheet” type=“text/css”>’);</code></pre>
(Honest question; maybe there are performance implications I’m not aware of.)
Thanks for this great article. Definitely some food for thought here!
(P.S. This comment looks mangled in the comment preview even though I’m using perfectly valid Textile formatting. I’m confused, so submitting anyway ;) Please fix if necessary! Thanks.)