--- title: HTML5 跨瀏覽器兼容程式碼 slug: orphaned/HTML5_Cross_Browser_Polyfills original_slug: HTML5_Cross_Browser_Polyfills ---
這是個蒐集中文世界開發(但不一定原創)的跨瀏覽器兼容代碼、連結的地方,作為 Paul Irish《HTML5 Cross Browser Polyfills》的仿效文件。蒐集不會完全,因此也強烈建議繼續追蹤上述文件的進展,或是使用搜尋引擎。
歡迎貢獻新的代碼、連結,不過請注意放在這個地方的代碼皆屬於公有領域。
支援 Gecko:FullScreenAPI 草案的 {{ domxref("window.fullScreen") }} 與 {{ domxref("element.onfullscreenchange", "fullscreenchange") }} 事件 ,由贺师俊(hax)所提供:
if (!('fullScreen' in window)) Object.defineProperty(window, 'fullScreen', {
get: function() {
return (screen.width == window.outerWidth && screen.height == window.outerHeight)
}
})
var _fullScreen = window.fullScreen
if (!('onfullscreenchange' in window)) window.addEventListener('resize', function() {
var f = window.fullScreen
if (f != _fullScreen) {
_fullScreen = f
fireSimpleEvent('fullscreenchange', document, {bubbles:true})
}
}, false)
function fireSimpleEvent(type, target, option) {
if (!target) target = document
if (!option) option = {}
var evt = document.createEvent('Event')
evt.initEvent(type, !!option.bubbles, !!option.cancelable)
return target.dispatchEvent(evt)
}