Skip to content

Commit

Permalink
Fixing history support test for Firefox, since it doesn't support one…
Browse files Browse the repository at this point in the history
…vent in object
  • Loading branch information
remy committed Aug 23, 2010
1 parent 9a3d97b commit 237b024
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ RewriteCond %{HTTP_HOST} ^www\.html5demo\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^html5demo\.com$ [NC]
RewriteRule ^(.*)$ http://html5demos.com/$1 [R=301,L]

# RewriteCond %{HTTP_REFERER} ^$ [OR]
# RewriteCond %{HTTP_REFERER} !^http://(www\.|offline\.)?html5demos.com/.*$
# RewriteRule \.(gif|jpg|swf|flv|png|ogv|mp4|webm|js)$ [R=404,L]

# if the file or directory does exist
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
Expand Down
2 changes: 1 addition & 1 deletion css/html5demos.css
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,4 @@ body.view-source #view-source {
border: 1px solid #75784C;
background: #FF7;
color: #333521;
}
}
2 changes: 1 addition & 1 deletion demos/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
});
}

if (typeof history.pushState === 'undefined' || !('onpopstate' in window)) {
if (typeof history.pushState === 'undefined' || !isEventSupported('popstate')) {
state.className = 'fail';
} else {
state.className = 'success';
Expand Down
1 change: 0 additions & 1 deletion includes/footer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<footer><a href="/">HTML5 demos</a>/<a id="built" href="http://twitter.com/rem">@rem built this</a>/<a href="#view-source">view source</a></footer>
</section>
<a href="http://github.com/remy/html5demos"><img style="position: absolute; top: 0; left: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub" /></a>
Expand Down
9 changes: 9 additions & 0 deletions js/h5utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
// For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/
/*@cc_on'abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video'.replace(/\w+/g,function(n){document.createElement(n)})@*/

function isEventSupported(event, element) {
element = element || window;
var ok = 'on'+event in element;
if (ok) return ok;
element.setAttribute('on' + event, '');
ok = typeof(element['on'+event] == "function");
element.removeAttribute('on' + event);
return ok;
}

var addEvent = (function () {
if (document.addEventListener) {
Expand Down

0 comments on commit 237b024

Please sign in to comment.