Skip to content

Commit 855f98b

Browse files
committed
Fixed infinite loop in Chrome
1 parent fa2b172 commit 855f98b

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

htmlpreview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ var HTMLPreview = {
3333
}
3434
if(document.querySelectorAll('frameset').length)
3535
return; //Don't replace CSS/JS if it's a frameset, because it will be erased by document.write()
36-
link = document.getElementsByTagName('link[rel=stylesheet][href]');
36+
link = document.getElementsByTagName('link[rel=stylesheet]');
3737
for(i = 0; i < link.length; ++i) {
3838
href = link[i].href; //Get absolute URL
3939
if(href.indexOf('//raw.github.com') > 0 || href.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org
4040
HTMLPreview.send(href, 'loadCSS'); //Then load it using YQL
4141
}
4242
}
43-
script = document.querySelectorAll('script[src]');
43+
script = document.querySelectorAll('script');
4444
for(i = 0; i < script.length; ++i) {
4545
src = script[i].src; //Get absolute URL
4646
if(src.indexOf('//raw.github.com') > 0 || src.indexOf('//bitbucket.org') > 0) { //Check if it's from raw.github.com or bitbucket.org

htmlpreview.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
GitHub & BitBucket HTML Preview
2+
-------------------------------
3+
14
Many GitHub repositories don't use GitHub Pages to host their HTML files. **GitHub & BitBucket HTML Preview** allows you to render those files without cloning or downloading whole repositories. It is a client-side solution and does not involve any third party hosting servers (except for Yahoo! Query Language to fetch assets).
25

36
If you try to open raw versions of any HTML, CSS or JS files in a web browser directly from GitHub, all you will see are sources. GitHub forces them to use the "text/plain" content-type, so they cannot be interpreted. This script overrides it by using Yahoo! Query Language.

0 commit comments

Comments
 (0)