Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Use appendChild instead of insertBefore for a small perfomance boost
Browse files Browse the repository at this point in the history
- Fixes #11
  • Loading branch information
p3lim committed Aug 2, 2014
1 parent c3e700f commit eef93ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dotjs.js
Expand Up @@ -3,17 +3,17 @@ var hostname = location.hostname.replace(/^www\./, '');
var style = document.createElement('link');
style.rel = 'stylesheet';
style.href = chrome.extension.getURL('styles/' + hostname + '.css');
document.documentElement.insertBefore(style);
document.documentElement.appendChild(style);

var defaultStyle = document.createElement('link');
defaultStyle.rel = 'stylesheet';
defaultStyle.href = chrome.extension.getURL('styles/default.css');
document.documentElement.insertBefore(defaultStyle);
document.documentElement.appendChild(defaultStyle);

var script = document.createElement('script');
script.src = chrome.extension.getURL('scripts/' + hostname + '.js');
document.documentElement.insertBefore(script);
document.documentElement.appendChild(script);

var defaultScript = document.createElement('script');
defaultScript.src = chrome.extension.getURL('scripts/default.js');
document.documentElement.insertBefore(defaultScript);
document.documentElement.appendChild(defaultScript);

1 comment on commit eef93ee

@fuba
Copy link

@fuba fuba commented on eef93ee Aug 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.