Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance #10

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions tinycon.js
Expand Up @@ -24,7 +24,7 @@
fallback: true fallback: true
}; };


var ua = (function (browser) { var ua = (function () {
var agent = navigator.userAgent.toLowerCase(); var agent = navigator.userAgent.toLowerCase();
// New function has access to 'agent' via closure // New function has access to 'agent' via closure
return function (browser) { return function (browser) {
Expand All @@ -42,9 +42,10 @@
// private // private
var getFaviconTag = function(){ var getFaviconTag = function(){


var links = document.getElementsByTagName('link'); var links = document.getElementsByTagName('link'),
i = links.length;


for(var i=0, len=links.length; i < len; i++) { while (i--) {
if (links[i].getAttribute('rel') === 'icon') { if (links[i].getAttribute('rel') === 'icon') {
return links[i]; return links[i];
} }
Expand All @@ -55,10 +56,11 @@


var removeFaviconTag = function(){ var removeFaviconTag = function(){


var links = document.getElementsByTagName('link'); var head = document.getElementsByTagName('head')[0],
var head = document.getElementsByTagName('head')[0]; links = document.getElementsByTagName('link'),
i = links.length


for(var i=0, len=links.length; i < len; i++) { while (i--) {
if (links[i].getAttribute('rel') === 'icon') { if (links[i].getAttribute('rel') === 'icon') {
head.removeChild(links[i]); head.removeChild(links[i]);
} }
Expand Down