Fixing history support test for Firefox, since it doesn't support onevent in object

This commit is contained in:
remy 2010-08-23 17:15:31 +01:00
parent 9a3d97b8d5
commit 237b024023
5 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -254,4 +254,4 @@ body.view-source #view-source {
border: 1px solid #75784C;
background: #FF7;
color: #333521;
}
}

View File

@ -60,7 +60,7 @@ function reportData(data) {
});
}
if (typeof history.pushState === 'undefined' || !('onpopstate' in window)) {
if (typeof history.pushState === 'undefined' || !isEventSupported('popstate')) {
state.className = 'fail';
} else {
state.className = 'success';

View File

@ -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>

View File

@ -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) {