From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- .../zh-tw/html5_cross_browser_polyfills/index.html | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 files/zh-tw/html5_cross_browser_polyfills/index.html (limited to 'files/zh-tw/html5_cross_browser_polyfills/index.html') diff --git a/files/zh-tw/html5_cross_browser_polyfills/index.html b/files/zh-tw/html5_cross_browser_polyfills/index.html new file mode 100644 index 0000000000..d823a44760 --- /dev/null +++ b/files/zh-tw/html5_cross_browser_polyfills/index.html @@ -0,0 +1,34 @@ +--- +title: HTML5 跨瀏覽器兼容程式碼 +slug: HTML5_Cross_Browser_Polyfills +--- +

這是個蒐集中文世界開發(但不一定原創)的跨瀏覽器兼容代碼、連結的地方,作為 Paul Irish《HTML5 Cross Browser Polyfills》的仿效文件。蒐集不會完全,因此也強烈建議繼續追蹤上述文件的進展,或是使用搜尋引擎。

+

歡迎貢獻新的代碼、連結,不過請注意放在這個地方的代碼皆屬於公有領域

+

全頻(fullscreen)API

+

支援  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)
+}
+
+

中文排版

+ -- cgit v1.2.3-54-g00ecf