Skip to content

Commit

Permalink
[zh-tw] sync translated content (#17187)
Browse files Browse the repository at this point in the history
Co-authored-by: Allo <[email protected]>
  • Loading branch information
mdn-bot and yin1999 authored Nov 30, 2023
1 parent 4648b64 commit 108531a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion files/zh-tw/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@
/zh-TW/docs/Web/Guide/HTML/Forms/How_to_structure_an_HTML_form /zh-TW/docs/Learn/Forms/How_to_structure_a_web_form
/zh-TW/docs/Web/Guide/HTML/HTML5 /zh-TW/docs/Glossary/HTML5
/zh-TW/docs/Web/Guide/HTML/HTML5/Introduction_to_HTML5 /zh-TW/docs/Learn/HTML
/zh-TW/docs/Web/Guide/Writing_forward-compatible_websites /zh-TW/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript
/zh-TW/docs/Web/Guide/圖像 /zh-TW/docs/Web/Guide/Graphics
/zh-TW/docs/Web/HTML/Block-level_elements /zh-TW/docs/Glossary/Block-level_content
/zh-TW/docs/Web/HTML/Canvas /zh-TW/docs/Web/API/Canvas_API
Expand Down Expand Up @@ -602,7 +603,7 @@
/zh-TW/docs/WebSockets/Writing_WebSocket_client_applications /zh-TW/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
/zh-TW/docs/Web_Audio_API /zh-TW/docs/Web/API/Web_Audio_API
/zh-TW/docs/Web_development /zh-TW/docs/Web/Guide
/zh-TW/docs/Web_development/Writing_forward-compatible_websites /zh-TW/docs/Web/Guide/Writing_forward-compatible_websites
/zh-TW/docs/Web_development/Writing_forward-compatible_websites /zh-TW/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript
/zh-TW/docs/Web_開發 /zh-TW/docs/Web/Guide
/zh-TW/docs/Web_開發/Historical_artifacts_to_avoid /zh-TW/docs/Learn/HTML/Introduction_to_HTML
/zh-TW/docs/Web_開發/Web開發入門 /zh-TW/docs/Web/Guide/Introduction_to_Web_development
Expand Down
8 changes: 4 additions & 4 deletions files/zh-tw/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,10 @@
"modified": "2020-07-16T22:39:19.937Z",
"contributors": ["wbamberg", "iigmir", "roycrxtw"]
},
"Learn/Tools_and_testing/Cross_browser_testing/JavaScript": {
"modified": "2019-03-24T00:17:14.604Z",
"contributors": ["fscholz", "irvinfly", "Littlebtc", "Sonrisa", "sycheng"]
},
"MDN": {
"modified": "2019-09-10T15:45:39.460Z",
"contributors": [
Expand Down Expand Up @@ -2715,10 +2719,6 @@
"modified": "2019-03-23T23:28:22.570Z",
"contributors": ["fscholz", "carl_tw"]
},
"Web/Guide/Writing_forward-compatible_websites": {
"modified": "2019-03-24T00:17:14.604Z",
"contributors": ["fscholz", "irvinfly", "Littlebtc", "Sonrisa", "sycheng"]
},
"Web/HTML": {
"modified": "2020-10-16T05:00:10.652Z",
"contributors": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Writing forward-compatible websites
slug: Web/Guide/Writing_forward-compatible_websites
slug: Learn/Tools_and_testing/Cross_browser_testing/JavaScript
original_slug: Web/Guide/Writing_forward-compatible_websites
---

這個頁面將解釋如何撰寫在新的瀏覽器版本發布時不會遭受毀損的網頁。
Expand All @@ -13,7 +14,7 @@ slug: Web/Guide/Writing_forward-compatible_websites

當一個事件處理器內容屬性(例如:`onclick`, `onmouseover` 等等)被使用在 HTML 的元素上時,所有對於屬性內名稱的查找首先發生在元素本身,若元素為表單控制項,再來尋找元素的表單,接著是 document,最後是 window(你定義全域變數的地方)。例如,如果你有這樣的原始碼:

```plain
```html
<div onclick="alert(ownerDocument)">點我一下</div>
```

Expand All @@ -23,10 +24,10 @@ slug: Web/Guide/Writing_forward-compatible_websites

為了避免這種情況,以 window 來限定全域變數的存取,例如:

```plain
```html
<script>
function localName() {
alert('函式 localName 被呼叫了');
alert("函式 localName 被呼叫了");
}
</script>
<div onclick="window.localName()">按一下會跑出一個提示訊息</div>
Expand Down Expand Up @@ -92,7 +93,7 @@ slug: Web/Guide/Writing_forward-compatible_websites

廠商前綴的功能可以在將來的版本中改變。然而,一旦瀏覽器已提供不帶前綴的功能,你可以在確保不帶前綴版在可用時總會被套用下,使用前綴版本針對舊版本。一個很好的例子,假設`-vnd` 廠商已經將不帶前綴的 `make-it-pretty` 屬性實作加入新出品的瀏覽器,包含一個前綴版與不含前綴版作用不同的值「`sometimes`」:

```plain
```html
<style>
.pretty-element {
-vnd-make-it-pretty: sometimes;
Expand Down

0 comments on commit 108531a

Please sign in to comment.