Skip to content

Commit 237b024

Browse files
committed
Fixing history support test for Firefox, since it doesn't support onevent in object
1 parent 9a3d97b commit 237b024

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

.htaccess

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ RewriteCond %{HTTP_HOST} ^www\.html5demo\.com$ [NC,OR]
99
RewriteCond %{HTTP_HOST} ^html5demo\.com$ [NC]
1010
RewriteRule ^(.*)$ http://html5demos.com/$1 [R=301,L]
1111

12+
# RewriteCond %{HTTP_REFERER} ^$ [OR]
13+
# RewriteCond %{HTTP_REFERER} !^http://(www\.|offline\.)?html5demos.com/.*$
14+
# RewriteRule \.(gif|jpg|swf|flv|png|ogv|mp4|webm|js)$ [R=404,L]
15+
1216
# if the file or directory does exist
1317
RewriteCond %{REQUEST_FILENAME} -d [OR]
1418
RewriteCond %{REQUEST_FILENAME} -f

css/html5demos.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,4 @@ body.view-source #view-source {
254254
border: 1px solid #75784C;
255255
background: #FF7;
256256
color: #333521;
257-
}
257+
}

demos/history.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
});
6161
}
6262

63-
if (typeof history.pushState === 'undefined' || !('onpopstate' in window)) {
63+
if (typeof history.pushState === 'undefined' || !isEventSupported('popstate')) {
6464
state.className = 'fail';
6565
} else {
6666
state.className = 'success';

includes/footer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<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>
32
</section>
43
<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>

js/h5utils.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
// For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/
22
/*@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)})@*/
33

4+
function isEventSupported(event, element) {
5+
element = element || window;
6+
var ok = 'on'+event in element;
7+
if (ok) return ok;
8+
element.setAttribute('on' + event, '');
9+
ok = typeof(element['on'+event] == "function");
10+
element.removeAttribute('on' + event);
11+
return ok;
12+
}
413

514
var addEvent = (function () {
615
if (document.addEventListener) {

0 commit comments

Comments
 (0)