aboutsummaryrefslogtreecommitdiff
path: root/files/ja/learn/tools_and_testing
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/learn/tools_and_testing
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/learn/tools_and_testing')
-rw-r--r--files/ja/learn/tools_and_testing/client-side_javascript_frameworks/index.html138
-rw-r--r--files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_components/index.html450
-rw-r--r--files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.html468
-rw-r--r--files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_todo_list_beginning/index.html599
-rw-r--r--files/ja/learn/tools_and_testing/client-side_javascript_frameworks/vue_getting_started/index.html301
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/accessibility/index.html624
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/automated_testing/index.html620
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/feature_detection/index.html357
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/html_and_css/index.html508
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/index.html47
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/introduction/index.html209
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/javascript/index.html521
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/testing_strategies/index.html372
-rw-r--r--files/ja/learn/tools_and_testing/cross_browser_testing/your_own_automation_environment/index.html688
-rw-r--r--files/ja/learn/tools_and_testing/index.html49
15 files changed, 5951 insertions, 0 deletions
diff --git a/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/index.html b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/index.html
new file mode 100644
index 0000000000..f49b505c56
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/index.html
@@ -0,0 +1,138 @@
+---
+title: Understanding client-side JavaScript frameworks
+slug: Learn/Tools_and_testing/Client-side_JavaScript_frameworks
+tags:
+ - Beginner
+ - Frameworks
+ - JavaScript
+ - Learn
+ - NeedsTranslation
+ - TopicStub
+ - client-side
+translation_of: Learn/Tools_and_testing/Client-side_JavaScript_frameworks
+---
+<div>{{LearnSidebar}}</div>
+
+<p class="summary">JavaScriptフレームワークは、最新のフロントエンドWeb開発に欠かせないものであり、開発者にスケーラブルでインタラクティブなWebアプリケーションを構築するための試行錯誤されたツールを提供しています。現代の多くの企業では、フレームワークをツールの標準的な一部として使用しているため、多くのフロントエンド開発の仕事でフレームワークの経験が必要とされています。</p>
+
+<p class="summary">フロントエンド開発者を目指していると、フレームワークを学ぶ際にどこから始めればいいのか悩むことがあります。— there are so many different frameworks to choose from, new ones appear all the time, they mostly work in a similar way but do some things differently, and there are some specific things to be careful about when using frameworks.</p>
+
+<p class="summary">この記事では、あなたがフレームワークを学び始めるための快適な出発点を提供することを目的としています。私たちは、React/ReactDOMやVue、その他の特定のフレームワークについて知っておく必要があるすべてのことを網羅的に教えることを目指しているわけではありません。その代わりに、以下のようなより基本的な質問に答えたいと思います。</p>
+
+<ul>
+ <li class="summary">なぜフレームワークを使うべきなのか?どんな問題を解決してくれるのか?</li>
+ <li class="summary">フレームワークを選ぼうとするとき、どのような質問をすればいいか?フレームワークを使う必要があるのか?</li>
+ <li class="summary">フレームワークにはどのような機能があるのか?フレームワークは一般的にどのように機能するのか、そしてその機能の実装はどのように異なるのか?</li>
+ <li class="summary">これらは素のJavaScriptやHTMLとどのように関係しているのか?</li>
+</ul>
+
+<p class="summary">その後、異なるフレームワークの選択の要点をカバーするチュートリアルをいくつか提供し、あなたが自分自身でより深く学び始めるのに十分なコンテキストと親しみやすさを提供します。アクセシビリティなどのウェブプラットフォームの基本的なベストプラクティスを忘れずに、実用的な方法でフレームワークについて学んでいただきたいと思います。</p>
+
+<p class="summary"><strong><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Introduction">Get started now, with "Introduction to client-side frameworks"</a></strong></p>
+
+<h2 id="Prerequisites">Prerequisites</h2>
+
+<p>You should really learn the basics of the core web languages first before attempting to move on to learning client-side frameworks — <a href="/en-US/docs/Learn/HTML">HTML</a>, <a href="/en-US/docs/Learn/CSS">CSS</a>, and especially <a href="/en-US/docs/Learn/JavaScript">JavaScript</a>.</p>
+
+<p>Your code will be richer and more professional as a result, and you'll be able to troubleshoot problems with more confidence if you understand the fundamental web platform features that the frameworks are building on top of.</p>
+
+<h2 id="Introductory_guides">Introductory guides</h2>
+
+<dl>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Introduction">1. Introduction to client-side frameworks</a></dt>
+ <dd>We begin our look at frameworks with a general overview of the area, looking at a brief history of JavaScript and frameworks, why frameworks exist and what they give us, how to start thinking about choosing a framework to learn, and what alternatives there are to client-side frameworks.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Main_features">2. Framework main features</a></dt>
+ <dd>Each major JavaScript framework has a different approach to updating the DOM, handling browser events, and providing an enjoyable developer experience. This article will explore the main features of “the big 4” frameworks, looking at how frameworks tend to work from a high level and the differences between them.</dd>
+</dl>
+
+<h2 id="React_tutorials">React tutorials</h2>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: React tutorials last tested in May 2020, with React/ReactDOM 16.13.1 and create-react-app 3.4.1.</p>
+
+<p>If you need to check your code against our version, you can find a finished version of the sample React app code in our <a href="https://github.com/mdn/todo-react">todo-react repository</a>. For a running live version, see <a href="https://mdn.github.io/todo-react-build/">https://mdn.github.io/todo-react-build/</a>.</p>
+</div>
+
+<dl>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started">1. Getting started with React</a></dt>
+ <dd>In this article we will say hello to React. We'll discover a little bit of detail about its background and use cases, set up a basic React toolchain on our local computer, and create and play with a simple starter app, learning a bit about how React works in the process.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning">2. Beginning our React todo list</a></dt>
+ <dd>Let's say that we’ve been tasked with creating a proof-of-concept in React – an app that allows users to add, edit, and delete tasks they want to work on, and also mark tasks as complete without deleting them. This article will walk you through putting the basic <code>App</code> component structure and styling in place, ready for individual component definition and interactivity, which we'll add later.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components">3. Componentizing our React app</a></dt>
+ <dd>At this point, our app is a monolith. Before we can make it do things, we need to break it apart into manageable, descriptive components. React doesn’t have any hard rules for what is and isn’t a component – that’s up to you! In this article, we will show you a sensible way to break our app up into components.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state">4. React interactivity: Events and state</a></dt>
+ <dd>With our component plan worked out, it's now time to start updating our app from a completely static UI to one that actually allows us to interact and change things. In this article we'll do this, digging into events and state along the way.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering">5. React interactivity: Editing, filtering, conditional rendering</a></dt>
+ <dd>As we near the end of our React journey (for now at least), we'll add the finishing touches to the main areas of functionality in our Todo list app. This includes allowing you to edit existing tasks and filtering the list of tasks between all, completed, and incomplete tasks. We'll look at conditional UI rendering along the way.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility">6. Accessibility in React</a></dt>
+ <dd>In our final tutorial article, we'll focus on (pun intended) accessibility, including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screen reader users.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_resources">7. React resources</a></dt>
+ <dd>Our final article provides you with a list of React resources that you can use to go further in your learning.</dd>
+</dl>
+
+<h2 id="Ember_tutorials">Ember tutorials</h2>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: Ember tutorials last tested in May 2020, with Ember/Ember CLI version 3.18.0.</p>
+
+<p>If you need to check your code against our version, you can find a finished version of the sample Ember app code in the <a href="https://github.com/NullVoxPopuli/ember-todomvc-tutorial/tree/master/steps/00-finished-todomvc/todomvc">ember-todomvc-tutorial repository</a>. For a running live version, see <a href="https://nullvoxpopuli.github.io/ember-todomvc-tutorial/">https://nullvoxpopuli.github.io/ember-todomvc-tutorial/</a> (this also includes a few additional features not covered in the tutorial).</p>
+</div>
+
+<dl>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_getting_started">1. Getting started with Ember</a></dt>
+ <dd>In our first Ember article we will look at how Ember works and what it's useful for, install the Ember toolchain locally, create a sample app, and then do some initial setup to get it ready for development.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_structure_componentization">2. Ember app structure and componentization</a></dt>
+ <dd>In this article we'll get right on with planning out the structure of our TodoMVC Ember app, adding in the HTML for it, and then breaking that HTML structure into components.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_interactivity_events_state">3. Ember interactivity: Events, classes and state</a></dt>
+ <dd>At this point we'll start adding some interactivity to our app, providing the ability to add and display new todo items. Along the way, we'll look at using events in Ember, creating component classes to contain JavaScript code to control interactive features, and setting up a service to keep track of the data state of our app.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_conditional_footer">4. Ember Interactivity: Footer functionality, conditional rendering</a></dt>
+ <dd>Now it's time to start tackling the footer functionality in our app. Here we'll get the todo counter to update to show the correct number of todos still to complete, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). We'll also wire up our "Clear completed" button. Along the way, we'll learn about using conditional rendering in our templates.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_routing">5. Routing in Ember</a></dt>
+ <dd>In this article we learn about routing or URL-based filtering as it is sometimes referred to. We'll use it to provide a unique URL for each of the three todo views — "All", "Active", and "Completed".</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_resources">6. Ember resources and troubleshooting</a></dt>
+ <dd>Our final Ember article provides you with a list of resources that you can use to go further in your learning, plus some useful troubleshooting and other information.</dd>
+</dl>
+
+<h2 id="Vue_tutorials">Vue tutorials</h2>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: Vue tutorials last tested in May 2020, with Vue 2.6.11.</p>
+
+<p>If you need to check your code against our version, you can find a finished version of the sample Vue app code in our <a href="https://github.com/mdn/todo-vue">todo-vue repository</a>. For a running live version, see <a href="https://mdn.github.io/todo-vue/dist/">https://mdn.github.io/todo-vue/dist/</a>.</p>
+</div>
+
+<dl>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_getting_started">1. Getting started with Vue</a></dt>
+ <dd>Now let's introduce Vue, the third of our frameworks. In this article, we'll look at a little bit of Vue background, learn how to install it and create a new project, study the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to start building our example.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component">2. Creating our first Vue component</a></dt>
+ <dd>Now it's time to dive deeper into Vue, and create our own custom component — we'll start by creating a component to represent each item in the todo list. Along the way, we'll learn about a few important concepts such as calling components inside other components, passing data to them via props and saving data state.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_rendering_lists">3. Rendering a list of Vue components</a></dt>
+ <dd><span class="author-d-1gg9uz65z1iz85zgdz68zmqkz84zo2qoxwoxz78zz83zz84zz69z2z80zgwxsgnz83zfkt5e5tz70zz68zmsnjz122zz71z">At this point we've got a fully working component; we're now ready to add multiple <code>ToDoItem</code> components to our App. In this article we'll look at adding a set of todo item data to our <code>App.vue</code> component, which we'll then loop through and display inside <code>ToDoItem</code> components using the <code>v-for</code> directive. </span></dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_methods_events_models">4. Adding a new todo form: Vue events, methods, and models</a></dt>
+ <dd>We now have sample data in place and a loop that takes each bit of data and renders it inside a <code>ToDoItem</code> in our app. What we really need next is the ability to allow our users to enter their own todo items into the app, and for that, we'll need a text <code>&lt;input&gt;</code>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. This is what we'll cover in this article.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_styling">5. Styling Vue components with CSS</a></dt>
+ <dd>The time has finally come to make our app look a bit nicer. In this article, we'll explore the different ways of styling Vue components with CSS.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_computed_properties">6. Using Vue computed properties</a></dt>
+ <dd>In this article we'll add a counter that displays the number of completed todo items, using a feature of Vue called computed properties. These work similarly to methods but only re-run when one of their dependencies changes.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_conditional_rendering">7. Vue conditional rendering: editing existing todos</a></dt>
+ <dd>Now it is time to add one of the major parts of functionality that we're still missing — the ability to edit existing todo items. To do this, we will take advantage of Vue's conditional rendering capabilities — namely <code>v-if</code> and <code>v-else</code> — to allow us to toggle between the existing todo item view and an edit view where you can update todo item labels. We'll also look at adding functionality to delete todo items.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_refs_focus_management">8. Focus management with Vue refs</a></dt>
+ <dd>We are nearly done with Vue. The last bit of functionality to look at is focus management, or put another way, how we can improve our app's keyboard accessibility. We'll look at using Vue refs to handle this — an advanced feature that allows you to have direct access to the underlying DOM nodes below the virtual DOM, or direct access from one component to the internal DOM structure of a child component.</dd>
+ <dt><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_resources">9. Vue resources</a></dt>
+ <dd>Now we'll round off our study of Vue by giving you a list of resources that you can use to go further in your learning, plus some other useful tips.</dd>
+</dl>
+
+<h2 id="Which_frameworks_did_we_choose">Which frameworks did we choose?</h2>
+
+<p>We are publishing our initial set of articles with guides focusing on three of the major frameworks out there — React/ReactDOM, Ember, and Vue. There is a variety of reasons for this:</p>
+
+<ul>
+ <li>They are popular choices that will be around for a while — like with any software tool, it is good to stick with actively-developed choices that are likely to not be discontinued next week, and which will be desirable additions to your skill set when looking for a job.</li>
+ <li>They have strong communities and good documentation. It is very important to be able to get help with learning a complex subject, especially when you are just starting out.</li>
+ <li>We don't have the resources to cover <em>all</em> modern frameworks. That list would be very difficult to keep up-to-date anyway, as new ones appear all the time.</li>
+ <li>As a beginner, trying to choose what to focus on out of the huge number of choices available is a very real problem. Keeping the list short is therefore helpful.</li>
+</ul>
+
+<p>We want to say this upfront — we've <strong>not</strong> chosen the frameworks we are focusing on because we think they are the best, or because we endorse them in any way. We just think they score highly on the above criteria.</p>
+
+<p>Note that we were hoping to have more frameworks included upon initial publication, but we decided to release the content and then add more framework guides later, rather than delay it longer. If your favourite framework is not represented in this content and you'd like to help change that, feel free to discuss it with us! Get in touch with us via <a href="https://wiki.mozilla.org/Matrix">Matrix</a>, or <a href="https://discourse.mozilla.org/c/mdn">Discourse</a>, or drop us a mail on the <a href="mailto:mdn-admins@mozilla.org">mdn-admins list</a>.</p>
diff --git a/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_components/index.html b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_components/index.html
new file mode 100644
index 0000000000..43eedc76eb
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_components/index.html
@@ -0,0 +1,450 @@
+---
+title: React アプリのコンポーネント化
+slug: Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components
+translation_of: Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</div>
+
+<p class="summary">この時点では、アプリは一枚岩です。アプリに何かをさせる前に、管理しやすく、記述しやすいコンポーネントに分解する必要があります。React には、何がコンポーネントで何がコンポーネントでないかという難しいルールはありません。それはあなた次第なのです!この記事では、アプリをコンポーネントに分解するための賢明な方法を紹介します。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td>
+ <p><a href="/en-US/docs/Learn/HTML">HTML</a>、<a href="/en-US/docs/Learn/CSS">CSS</a>、<a href="/en-US/docs/Learn/JavaScript">JavaScript</a> のコア言語に精通していること、<a href="/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line">ターミナル/コマンドライン</a>の知識があること。</p>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row">目的:</th>
+ <td>Todo リストアプリをコンポーネントに分割するための賢明な方法を示すこと。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="最初のコンポーネントの定義">最初のコンポーネントの定義</h2>
+
+<p>コンポーネントの定義は、ある程度練習をするまでは難しいと思われるかもしれませんが、要点は以下の通りです。</p>
+
+<ul>
+ <li>アプリの明らかな "カタマリ" を表している場合、それはおそらくコンポーネントです。</li>
+ <li>よく再利用されるのであれば、それはおそらくコンポーネントです。</li>
+</ul>
+
+<p>2 番目の箇条書きは特に価値があります: 一般的な UI 要素からコンポーネントを作成することで、コードを一箇所で変更することができ、そのコンポーネントが使用される場所のどこでも変更内容を確認することができます。また、すぐにすべてをコンポーネントに分割する必要もありません。2 つ目の箇条書きをヒントに、UI の中で最も再利用され、最も重要な部分である TODO リスト項目からコンポーネントを作成してみましょう。</p>
+
+<h2 id="&lt;Todo_>の作成"><code>&lt;Todo /&gt;</code>の作成</h2>
+
+<p>コンポーネントを作る前に、そのための新しいファイルを作らなければなりません。実は、コンポーネント用の新しいディレクトリの作成が必要です。次のコマンドは、<code>components</code> ディレクトリを作成し、その中に <code>Todo.js</code> というファイルを作成します。これらを実行する前に、アプリのルートにいることを確認してください!</p>
+
+<pre class="brush: bash notranslate">mkdir src/components
+touch src/components/Todo.js</pre>
+
+<p>新しい <code>Todo.js</code> ファイルは今は空です。ファイルを開いて最初の行に次を入力してください。</p>
+
+<pre class="brush: js notranslate">import React from "react";</pre>
+
+<p>今回は <code>Todo</code> というコンポーネントを作る予定なので、以下のように <code>Todo.js</code> にもそのためのコードを追加していきます。このコードでは、関数の定義とエクスポートを一行で定義しています。</p>
+
+<pre class="brush: js notranslate">export default function Todo() {
+ return (
+
+ );
+}</pre>
+
+<p>ここまでは問題ありませんが、このコンポーネントは何かを返さなければなりません!<code>src/App.js</code> に戻って、最初の <code><a href="/en-US/docs/Web/HTML/Element/li">&lt;li&gt;</a></code> をコピーし、<code>Todo.js</code> に貼り付けて、以下のように読み込みます。</p>
+
+<pre class="brush: js notranslate">export default function Todo() {
+ return (
+ &lt;li className="todo stack-small"&gt;
+ &lt;div className="c-cb"&gt;
+ &lt;input id="todo-0" type="checkbox" defaultChecked={true} /&gt;
+ &lt;label className="todo-label" htmlFor="todo-0"&gt;
+ Eat
+ &lt;/label&gt;
+ &lt;/div&gt;
+ &lt;div className="btn-group"&gt;
+ &lt;button type="button" className="btn"&gt;
+ Edit &lt;span className="visually-hidden"&gt;Eat&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;button type="button" className="btn btn__danger"&gt;
+ Delete &lt;span className="visually-hidden"&gt;Eat&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;/div&gt;
+ &lt;/li&gt;
+ );
+}</pre>
+
+<div class="blockIndicator note">
+<p><strong>注意</strong>: コンポーネントは常に何かを返さなければなりません。もし今後あなたが何も返さないコンポーネントをレンダリングしようとしたら、React はブラウザにエラーを表示するでしょう。</p>
+</div>
+
+<p>これで <code>Todo</code> コンポーネントは完成しました。<code>App.js</code> で、ファイルの先頭付近に次の行を追加して <code>Todo</code> をインポートします。</p>
+
+<pre class="brush: js notranslate">import Todo from "./components/Todo";</pre>
+
+<p>このコンポーネントをインポートすると、<code>App.js</code> の <code>&lt;li&gt;</code> 要素をすべて <code>&lt;Todo /&gt;</code> コンポーネント呼び出しに置き換えることができます。<code>&lt;ul&gt;</code> は以下のようになるはずです。</p>
+
+<pre class="brush: js notranslate">&lt;ul
+ role="list"
+ className="todo-list stack-large stack-exception"
+ aria-labelledby="list-heading"
+&gt;
+ &lt;Todo /&gt;
+ &lt;Todo /&gt;
+ &lt;Todo /&gt;
+&lt;/ul&gt;</pre>
+
+<p>ブラウザに戻ってみると、何か不幸なことに気づくでしょう: あなたのリストは、最初のタスクを3回繰り返すようになりました!</p>
+
+<p><img alt="Our todo list app, with todo components repeating because the label is hardcoded into the component" src="https://mdn.mozillademos.org/files/17255/todo-list-repeating-todos.png" style="border-style: solid; border-width: 1px; height: 954px; width: 856px;"></p>
+
+<p>私たちは食べたいだけではなく、他にもやるべきこと — そう、TODO があります。次に、異なるコンポーネント呼び出しで別々のコンテンツをレンダリングする方法を見てみましょう。</p>
+
+<h2 id="「一意の」_&lt;Todo_>_を作成">「一意の」 <code>&lt;Todo /&gt;</code> を作成</h2>
+
+<p>コンポーネントが強力なのは、UI の一部を再利用し、その UI のソースを 1 か所で参照できるからです。問題は、通常、各コンポーネントのすべてを再利用するのではなく、ほとんどの部分を再利用しつつ小さな部分を変更したいということです。そこでプロップ( props )の出番です。</p>
+
+<h3 id="name_に何が入るでしょう?"><code>name</code> に何が入るでしょう?</h3>
+
+<p>完了させたいタスクの名前を追跡するために、それぞれの <code>&lt;Todo /&gt;</code> コンポーネントが一意の名前を表示するようにしなければなりません。</p>
+
+<p><code>App.js</code>では、それぞれの <code>&lt;Todo /&gt;</code> に名前のプロップを与えます。先ほどのタスクの名前を使ってみましょう。</p>
+
+<pre class="brush: js notranslate">&lt;Todo name="Eat" /&gt;
+&lt;Todo name="Sleep" /&gt;
+&lt;Todo name="Repeat" /&gt;</pre>
+
+<p>ブラウザを更新すると...以前と全く同じものが表示されます。<code>&lt;Todo /&gt;</code> にプロップを与えましたが、まだ使っていません。<code>Todo.js</code> に戻って解決しましょう。</p>
+
+<p>最初に <code>Todo()</code> 関数の定義を変更して、<code>props</code> をパラメータとして受け取るようにします。<code>props</code> がコンポーネントによって正しく受信されているかどうかを確認したい場合は、先ほどと同様に <code>console.log()</code> で <code>props</code> を取得することができます。</p>
+
+<p>コンポーネントが <code>props</code> を取得していることを確認したら、<code>Eat</code> を <code>name</code> のプロップで置き換えることができます。覚えておいてください: JSX の式の途中では、中括弧を使って変数の値を注入します。</p>
+
+<p>これらをまとめると、<code>Todo()</code> 関数は次のようになるはずです。</p>
+
+<pre class="brush: js notranslate">export default function Todo(props) {
+ return (
+ &lt;li className="todo stack-small"&gt;
+ &lt;div className="c-cb"&gt;
+ &lt;input id="todo-0" type="checkbox" defaultChecked={true} /&gt;
+ &lt;label className="todo-label" htmlFor="todo-0"&gt;
+ {props.name}
+ &lt;/label&gt;
+ &lt;/div&gt;
+ &lt;div className="btn-group"&gt;
+ &lt;button type="button" className="btn"&gt;
+ Edit &lt;span className="visually-hidden"&gt;{props.name}&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;button type="button" className="btn btn__danger"&gt;
+ Delete &lt;span className="visually-hidden"&gt;{props.name}&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;/div&gt;
+ &lt;/li&gt;
+ );
+}</pre>
+
+<p>これで、ブラウザには3つの一意のタスクが表示されるようになりました。しかし、もう一つの問題が残っています: これらはすべてデフォルトでチェックされています。</p>
+
+<p><img alt="Our todo list, with different todo labels now they are passed into the components as props" src="https://mdn.mozillademos.org/files/17256/todo-list-unique-todos.png" style="border-style: solid; border-width: 1px; height: 954px; width: 856px;"></p>
+
+<h3 id="それは_completed_ですか?">それは <code>completed</code> ですか?</h3>
+
+<p>元の静的リストでは、<code>Eat</code> だけがチェックされていました。もう一度言いますが、<code>&lt;Todo /&gt;</code>コンポーネントを構成するUIのほとんどを再利用しつつ、一つだけ変更したいのです。これは別のプロップが良い仕事をしてくれます!<code>App.js</code> での各 <code>&lt;Todo /&gt;</code> の呼び出しには、完了したことを示す新しいプロップを与えます。最初の (<code>Eat</code>) は <code>true</code> の値を持ち、残りは <code>false</code> にします。</p>
+
+<pre class="brush: js notranslate">&lt;Todo name="Eat" completed={true} /&gt;
+&lt;Todo name="Sleep" completed={false} /&gt;
+&lt;Todo name="Repeat" completed={false} /&gt;</pre>
+
+<p>先ほどと同様に、これらのプロップを実際に使用するためには <code>Todo.js</code> に戻る必要があります。<code>&lt;input /&gt;</code> の <code>defaultChecked</code> 属性の値が <code>completed</code> したプロップと同じになるように変更します。これで、Todo コンポーネントの <code>&lt;input /&gt;</code> 要素は次のようになります。</p>
+
+<pre class="brush: js notranslate">&lt;input id="todo-0" type="checkbox" defaultChecked={props.completed} /&gt;</pre>
+
+<p>そして、ブラウザを更新すると、<code>Eat</code> だけがチェックされていることが表示されるようになるはずです。</p>
+
+<p><img alt="Our todo list app, now with differing checked states - some checkboxes are checked, others not" src="https://mdn.mozillademos.org/files/17254/todo-list-differing-checked-states.png" style="border-style: solid; border-width: 1px; height: 954px; width: 856px;"></p>
+
+<p>各 <code>&lt;Todo /&gt;</code> コンポーネントの<code>conpleted</code> プロップを変更すると、ブラウザはそれに応じてレンダリングされた同等のチェックボックスをチェックしたり、チェックを外したりします。</p>
+
+<h3 id="id_をください"><code>id</code> をください</h3>
+
+<p>現在、<code>&lt;Todo /&gt;</code> コンポーネントはすべてのタスクに <code>todo-0</code> という <code>id</code> 属性を与えています。これは悪い HTML です、なぜなら <a href="/en-US/docs/Web/HTML/Global_attributes/id">id 属性</a>は一意でなければならないからです (CSS や JavaScript などでドキュメントフラグメントの一意な識別子として使用されます)。つまり、各 <code>Todo</code> に対して一意の値を取る <code>id</code> プロップをコンポーネントに与えるべきです。</p>
+
+<p>最初と同じパターンに従うために、<code>&lt;Todo /&gt;</code> コンポーネントの各インスタンスに <code>todo-i</code> の形式で ID を与えてみましょう。<code>i</code> は毎回1つずつ大きくなっていきます。</p>
+
+<pre class="brush: js notranslate">&lt;Todo name="Eat" completed={true} id="todo-0" /&gt;
+&lt;Todo name="Sleep" completed={false} id="todo-1" /&gt;
+&lt;Todo name="Repeat" completed={false} id="todo-2" /&gt;</pre>
+
+<p>ここで <code>Todo.js</code> に戻り、<code>id</code> プロップを使うようにします。これは <code>&lt;input /&gt;</code> 要素の <code>id</code> 属性の値とラベルの <code>htmlFor</code> 属性の値を置き換える必要があります。</p>
+
+<pre class="brush: js notranslate">&lt;div className="c-cb"&gt;
+ &lt;input id={props.id} type="checkbox" defaultChecked={props.completed} /&gt;
+ &lt;label className="todo-label" htmlFor={props.id}&gt;
+ {props.name}
+ &lt;/label&gt;
+&lt;/div&gt;</pre>
+
+<h2 id="ここまでは順調ですか?">ここまでは順調ですか?</h2>
+
+<p>今のところ React をうまく使っていますが、もっとうまくできるかもしれません!今のコードは反復的です。<code>&lt;Todo /&gt;</code> コンポーネントをレンダリングする3つの行はほぼ同じですが、1つだけ違う点があります: それぞれのプロップの値です。</p>
+
+<p>JavaScript のコアな能力の一つであるイテレーション(反復処理)を使えば、コードをクリーンアップすることができます。イテレーションを使うためには、まず自分のタスクを再考する必要があります。</p>
+
+<h2 id="データとしてのタスク">データとしてのタスク</h2>
+
+<p>それぞれのタスクには現在、3つの情報が含まれています: 名前、チェック済みかどうか、そして一意なIDです。このデータはうまくオブジェクトに変換されます。複数のタスクがあるので、このデータを表現するにはオブジェクトの配列が有効です。</p>
+
+<p>import の後 <code>ReactDOM.render()</code> より前の行で以下の <code>const</code> を作成してください。</p>
+
+<pre class="brush: js notranslate">const DATA = [
+ { id: "todo-0", name: "Eat", completed: true },
+ { id: "todo-1", name: "Sleep", completed: false },
+ { id: "todo-2", name: "Repeat", completed: false }
+];</pre>
+
+<p>次に、<code>tasks</code> という名前のプロップとして <code>&lt;App /&gt;</code> に <code>DATA</code> を渡します。<code>src/index.js</code> の最終行は以下のようになるはずです。</p>
+
+<pre class="brush: js notranslate">ReactDOM.render(&lt;App tasks={DATA} /&gt;, document.getElementById("root"));</pre>
+
+<p>この配列は、App コンポーネントで <code>props.tasks</code> として利用できるようになりました。よかったら <code>console.log()</code> で確認してください。</p>
+
+<div class="blockIndicator note">
+<p><strong>注意</strong>: <code>ALL_CAPS</code> 定数名は JavaScript では特別な意味はありません; 他の開発者に「このデータはここで定義された後は変更されません」と伝えるための慣習です。</p>
+</div>
+
+<h2 id="イテレーションによるレンダリング">イテレーションによるレンダリング</h2>
+
+<p>オブジェクトの配列をレンダリングするには、それぞれのオブジェクトを <code>&lt;Todo /&gt;</code> コンポーネントに変換しなければなりません。JavaScript では、データを別のものに変換するための配列メソッド <code>Array.prototype.map()</code> を提供しています。</p>
+
+<p>Above the return statement of <code>App()</code>, make a new <code>const</code> called <code>taskList</code> and use <code>map()</code> to transform it. Let's start by turning our <code>tasks</code> array into something simple: the <code>name</code> of each task:</p>
+
+<pre class="brush: js notranslate">const taskList = props.tasks.map(task =&gt; task.name);</pre>
+
+<p>Let’s try replacing all the children of the <code>&lt;ul&gt;</code> with <code>taskList</code>:</p>
+
+<pre class="brush: js notranslate">&lt;ul
+ role="list"
+ className="todo-list stack-large stack-exception"
+ aria-labelledby="list-heading"
+&gt;
+ {taskList}
+&lt;/ul&gt;</pre>
+
+<p>This gets us some of the way towards showing all the components again, but we’ve got more work to do: the browser currently renders each task's name as unstructured text. We’re missing our HTML structure — the <code>&lt;li&gt;</code> and its checkboxes and buttons!</p>
+
+<p><img alt="Our todo list app with the todo item labels just shown bunched up on one line" src="https://mdn.mozillademos.org/files/17257/todo-list-unstructured-names.png" style="border-style: solid; border-width: 1px; height: 627px; width: 856px;"></p>
+
+<p>To fix this, we need to return a <code>&lt;Todo /&gt;</code> component from our <code>map()</code> function — remember that JSX allows us to mix up JavaScript and markup structures! Let's try the following instead of what we have already:</p>
+
+<pre class="brush: js notranslate"> const taskList = props.tasks.map(task =&gt; &lt;Todo /&gt;);</pre>
+
+<p>Look again at your app; now our tasks look more like they used to, but they’re missing the names of the tasks themselves.  Remember that each task we map over has the <code>id</code>, <code>name</code>, and <code>checked</code> properties we want to pass into our <code>&lt;Todo /&gt;</code> component. If we put that knowledge together, we get code like this:</p>
+
+<pre class="brush: js notranslate">const taskList = props.tasks.map(task =&gt; (
+ &lt;Todo id={task.id} name={task.name} completed={task.completed} /&gt;
+));</pre>
+
+<p>Now the app looks like it did before, and our code is less repetitive.</p>
+
+<h2 id="Unique_keys">Unique keys</h2>
+
+<p>Now that React is rendering our tasks out of an array, it has to keep track of which one is which in order to render them properly. React tries to do its own guesswork to keep track of things, but we can help it out by passing a <code>key</code> prop to our <code>&lt;Todo /&gt;</code> components. <code>key</code> is a special prop that's managed by React – you cannot use the word <code>key</code> for any other purpose.</p>
+
+<p>Because keys should be unique, we're going to re-use the <code>id</code> of each task object as its key. Update your <code>taskList</code> constant like so:</p>
+
+<pre class="brush: js notranslate">const taskList = props.tasks.map(task =&gt; (
+    &lt;Todo
+      id={task.id}
+      name={task.name}
+      completed={task.completed}
+      key={task.id}
+    /&gt;
+  )
+);</pre>
+
+<p><strong>You should always pass a unique key to anything you render with iteration.</strong> Nothing obvious will change in your browser, but if you do not use unique keys, React will log warnings to your console and your app may behave strangely!</p>
+
+<h2 id="Componentizing_the_rest_of_the_app">Componentizing the rest of the app</h2>
+
+<p>Now that we've got our most important component sorted out, we can turn the rest of our app into components. Remembering that components are either obvious pieces of UI, or reused pieces of UI, or both, we can make two more components:</p>
+
+<ul>
+ <li><code>&lt;Form/&gt;</code></li>
+ <li><code>&lt;FilterButton/&gt;</code></li>
+</ul>
+
+<p>Since we know we need both, we can batch some of the file creation work together with a terminal command. Run this command in your terminal, taking care that you're in the root directory of your app:</p>
+
+<pre class="brush: bash notranslate">touch src/components/Form.js src/components/FilterButton.js</pre>
+
+<h3 id="The_&lt;Form_>">The <code>&lt;Form /&gt;</code></h3>
+
+<p>Open <code>components/Form.js</code> and do the following:</p>
+
+<ul>
+ <li>Import <code>React</code> at the top of the file, like we did in <code>Todo.js</code>.</li>
+ <li>Make yourself a new <code>Form()</code> component with the same basic structure as <code>Todo()</code>, and export that component.</li>
+ <li>Copy the <code>&lt;form&gt;</code> tags and everything between them from inside <code>App.js</code>, and paste them inside <code>Form()</code>’s <code>return</code> statement.</li>
+ <li>Export <code>Form</code> at the end of the file.</li>
+</ul>
+
+<p>Your <code>Form.js</code> file should read like this:</p>
+
+<pre class="brush: js notranslate">import React from "react";
+
+function Form(props) {
+ return (
+ &lt;form&gt;
+ &lt;h2 className="label-wrapper"&gt;
+ &lt;label htmlFor="new-todo-input" className="label__lg"&gt;
+ What needs to be done?
+ &lt;/label&gt;
+ &lt;/h2&gt;
+ &lt;input
+ type="text"
+ id="new-todo-input"
+ className="input input__lg"
+ name="text"
+ autoComplete="off"
+ /&gt;
+ &lt;button type="submit" className="btn btn__primary btn__lg"&gt;
+ Add
+ &lt;/button&gt;
+ &lt;/form&gt;
+ );
+}
+
+export default Form;</pre>
+
+<h3 id="The_&lt;FilterButton_>">The &lt;FilterButton /&gt;</h3>
+
+<p>Do the same things you did to create <code>Form.js</code> inside <code>FilterButton.js</code>, but call the component <code>FilterButton()</code> and copy the HTML for the first button inside the <code>&lt;div&gt;</code> element with the <code>class</code> of <code>filters</code> from <code>App.js</code> into the <code>return</code> statement.</p>
+
+<p>The file should read like this:</p>
+
+<pre class="brush: js notranslate">import React from "react";
+
+function FilterButton(props) {
+ return (
+ &lt;button type="button" className="btn toggle-btn" aria-pressed="true"&gt;
+ &lt;span className="visually-hidden"&gt;Show &lt;/span&gt;
+ &lt;span&gt;all &lt;/span&gt;
+ &lt;span className="visually-hidden"&gt; tasks&lt;/span&gt;
+ &lt;/button&gt;
+ );
+}
+
+export default FilterButton;</pre>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: You might notice that we are making the same mistake here as we first made for the <code>&lt;Todo /&gt;</code> component, in that each button will be the same. That’s fine! We’re going to fix up this component later on, in <a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering#Back_to_the_filter_buttons">Back to the filter buttons</a>.</p>
+</div>
+
+<h2 id="Importing_all_our_components">Importing all our components</h2>
+
+<p>Let's make use of our new components.</p>
+
+<p>Add some more <code>import</code> statements to the top of <code>App.js</code>, to import them.</p>
+
+<p>Then, update the <code>return</code> statement of <code>App()</code> so that it renders our components. When you’re done, <code>App.js</code> will read like this:</p>
+
+<pre class="brush: js notranslate">import React from "react";
+import Form from "./components/Form";
+import FilterButton from "./components/FilterButton";
+import Todo from "./components/Todo";
+
+function App(props) {
+ const taskList = props.tasks.map(task =&gt; (
+ &lt;Todo
+ id={task.id}
+ name={task.name}
+ completed={task.completed}
+ key={task.id}
+ /&gt;
+ )
+ );
+ return (
+ &lt;div className="todoapp stack-large"&gt;
+ &lt;Form /&gt;
+ &lt;div className="filters btn-group stack-exception"&gt;
+ &lt;FilterButton /&gt;
+ &lt;FilterButton /&gt;
+ &lt;FilterButton /&gt;
+ &lt;/div&gt;
+ &lt;h2 id="list-heading"&gt;3 tasks remaining&lt;/h2&gt;
+ &lt;ul
+ role="list"
+ className="todo-list stack-large stack-exception"
+ aria-labelledby="list-heading"
+ &gt;
+ {taskList}
+ &lt;/ul&gt;
+ &lt;/div&gt;
+ );
+}
+
+export default App;</pre>
+
+<p>With this in place, we’re <em>almost</em> ready to tackle some interactivity in our React app!</p>
+
+<h2 id="Summary">Summary</h2>
+
+<p>And that's it for this article — we've gone into some depth on how to break up your app nicely into components, end render them efficiently. Now we'll go on to look at how we handle events in React, and start adding some interactivity.</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</p>
+
+<h2 id="In_this_module">In this module</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Introduction">Introduction to client-side frameworks</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Main_features">Framework main features</a></li>
+ <li>React
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started">Getting started with React</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning">Beginning our React todo list</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components">Componentizing our React app</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state">React interactivity: Events and state</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering">React interactivity: Editing, filtering, conditional rendering</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility">Accessibility in React</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_resources">React resources</a></li>
+ </ul>
+ </li>
+ <li>Ember
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_getting_started">Getting started with Ember</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_structure_componentization">Ember app structure and componentization</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_interactivity_events_state">Ember interactivity: Events, classes and state</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_conditional_footer">Ember Interactivity: Footer functionality, conditional rendering</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_routing">Routing in Ember</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_resources">Ember resources and troubleshooting</a></li>
+ </ul>
+ </li>
+ <li>Vue
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_getting_started">Getting started with Vue</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component">Creating our first Vue component</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_rendering_lists">Rendering a list of Vue components</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_methods_events_models">Adding a new todo form: Vue events, methods, and models</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_styling">Styling Vue components with CSS</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_computed_properties">Using Vue computed properties</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_conditional_rendering">Vue conditional rendering: editing existing todos</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_refs_focus_management">Focus management with Vue refs</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_resources">Vue resources</a></li>
+ </ul>
+ </li>
+ <li>Svelte
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_getting_started">Getting started with Svelte</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_Todo_list_beginning">Starting our Svelte Todo list app</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_variables_props">Dynamic behavior in Svelte: working with variables and props</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_components">Componentizing our Svelte app</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_reactivity_lifecycle_accessibility">Advanced Svelte: Reactivity, lifecycle, accessibility</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_stores">Working with Svelte stores</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_TypeScript">TypeScript support in Svelte</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_deployment_next">Deployment and next steps</a></li>
+ </ul>
+ </li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.html b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.html
new file mode 100644
index 0000000000..5114539cca
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_getting_started/index.html
@@ -0,0 +1,468 @@
+---
+title: Reactをはじめる
+slug: >-
+ Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started
+tags:
+ - Beginner
+ - Frameworks
+ - JavaScript
+ - Learn
+ - React
+ - client-side
+translation_of: >-
+ Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Main_features","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</div>
+
+<p class="summary">この記事では React のはじめかたを説明します。Reactの背景と使い方について説明し、ローカル環境で基本的な React ツールチェーンを設定します。また、シンプルな基本アプリを作成して、React がどのようなプロセスで機能するのかを学んでいきます。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td>
+ <p><a href="/ja/docs/Learn/HTML">HTML</a>、<a href="/ja/docs/Learn/CSS">CSS</a>、<a href="/ja/docs/Learn/JavaScript">JavaScript</a> に精通していること、<a href="/ja/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line">ターミナル/コマンドライン</a>に関する知識があること。</p>
+
+ <p>React は JSX (JavaScript と XML) と呼ばれる HTML-in-JavaScript を使用します。HTML と JavaScript の両方に精通していると、JSX の学習に役立ち、アプリケーションのバグが JavaScript に関連しているか、React のより具体的なドメインに関連しているかを特定するのに役立つます。</p>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row">目的:</th>
+ <td>ローカルの React 開発環境をセットアップし、開始アプリを作成して、それがどのように機能するかの基本を理解する</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Hello_React" name="Hello_React">React の基礎</h2>
+
+<p>公式のキャッチフレーズにあるように、<a href="https://reactjs.org/">React</a> はユーザーインターフェイスを構築するためのライブラリーです。React はフレームワークではなく、ウェブに限定されるものでもありません。他のライブラリーと共に使用して、特定の環境にレンダリングしますます。たとえば、<a href="https://reactnative.dev/">React Native</a> はモバイルアプリケーションの構築に使用できます。<a href="https://facebook.github.io/react-360/">React 360</a> を使用して、仮想現実アプリケーションを構築できます。他にも可能性があります。</p>
+
+<p>ウェブ向けに構築するには、開発者は <a href="https://reactjs.org/docs/react-dom.html">ReactDOM</a> と連携してリアクトを使用します。リアクトと ReactDOM は、他の本当のウェブ開発フレームワークと同じ土台で議論さんくれ、同じような問題を解決するために用いられます。しかし React を「フレームワーク」と呼ぶとき、私たちはその口語的な理解に別途でいます。</p>
+
+<p>React が目指すところは、開発者がUIを構築しているときに発生するバグを最小限に抑えることです。これは、コンポーネント (ユーザーインターフェイスの一部を記述する自己完結型の論理的なコード) を使用して行われます。これらのコンポーネントを組み合わせて完全なUIを作成でき、React はレンダリング作業の大部分を抽象化して、UI デザインに集中できるようにします。</p>
+
+<h2 id="Use_cases" name="Use_cases">ユースケース</h2>
+
+<p>このモジュールで取り上げられている他のフレームワークとは異なり、React はコード規則やファイル編成に関する厳密なルールを適用しません。これにより、チームは自分に最適な規則を設定し、Reactを好きなように採用することができます。React は、単一のボタン、一部のインターフェース、またはアプリのユーザーインターフェース全体を処理できます。</p>
+
+<p>React は<a href="https://reactjs.org/docs/add-react-to-a-website.html">インターフェイスの一部</a>に適に用することが <em>できます</em> が、jQuery のようなライブラリーや Vue のようなフレームワークほどアプリケーションに「ドロップ」するのは簡単ではありません。React でアプリ全体を構築するのに適しています。</p>
+
+<p>さらに、JSX のインターフェースの作成など、React アプリの開発者体験にはコンパイルプロセスが必要とします。Babel のようなコンパイラーをウェブサイトに追加すると、コードの実行が遅くなるため、開発者はビルドステップでそのようなツールをセットアップすることがよくあります。間違いなく React には厳しいツール要件がありますが、学習することはできます。</p>
+
+<p>この記事では、Facebook 独自の<a href="https://create-react-app.dev/"> create-react-app</a> を使って、アプリケーションのインターフェイスを構築していきます。</p>
+
+<h2 id="How_does_React_use_JavaScript" name="How_does_React_use_JavaScript">ReactにおけるJavaScriptの書き方</h2>
+
+<p>Reactは、そのパターンの多くに最新の JavaScript の機能を利用しています。JavaScript からの最大の違いは、<a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a> 構文を使うことです。JSX は JavaScript の構文を拡張して、HTML のようにコードを書くことができます。例えば:</p>
+
+<pre class="brush: js notranslate">const heading = &lt;h1&gt;Mozilla Developer Network &lt;/h1&gt;;</pre>
+
+<p>この定数 heading は、<strong>JSX 式</strong>と呼ばれます。React はこのように <code><a href="/ja/docs/Web/HTML/Element/Heading_Elements">&lt;h1&gt;</a></code> タグをレンダリングすることができます。</p>
+
+<p>セマンティックの観点で、 <code><a href="/ja/docs/Web/HTML/Element/header">&lt;header&gt;</a></code> タグで、見出しを囲みたいとします。JSX では、HTML のように、要素を相互にネストできます。</p>
+
+<pre class="notranslate">const header = (
+ &lt;header&gt;
+ &lt;h1&gt;Mozilla Developer Network&lt;/h1&gt;
+ &lt;/header&gt;
+);</pre>
+
+<div class="blockIndicator note">
+<p><strong>注</strong>: このスニペットの括弧は JSX に固有のものではなく、あなたのアプリケーションに影響を与えません。それらは、あなた (またあなたのコンピューター) にとって、内部の複数行のコードが同じ式の一部であるという意味です。次のように header を定義することもできます。</p>
+
+<pre class="notranslate">const header = &lt;header&gt;
+ &lt;h1&gt;Mozilla Developer Network&lt;/h1&gt;
+&lt;/header&gt;</pre>
+
+<p>ただし、<code><a href="/ja/docs/Web/HTML/Element/header">&lt;header&gt;</a></code> 式を開始するタグが、対応する終了タグと同じ位置にインデントされていないため、これは少し読みにくいかもしれません。</p>
+</div>
+
+<p>もちろん、あなたのブラウザーはそのままでは JSX を読むことができません。(<a href="https://babeljs.io/">Babel</a> や <a href="https://parceljs.org/">Parcel</a> などのツールを使用して) コンパイルすると、ヘッダー式は次のようになります。</p>
+
+<pre class="brush: js notranslate">const header = React.createElement("header"、null、
+ React.createElement("h1"、null、 "Mozilla Developer Network")
+);</pre>
+
+<p>コンパイルステップとコンパイル自体をスキップし、<code><a href="https://reactjs.org/docs/react-api.html#createelement">React.createElement()</a></code> を使って、独自のUIを自分で書くこと。ただし、こうするとJSXの宣言的なメリットが失われ、コードが読みにくくなってしまいます。コンパイルは開発プロセスとは別のステップですが、Reactコミュニティの多くの開発者は、JSXの読みやすさに価値があると考えています。さらに、外部ツールにより、JSX から JavaScript へのコンパイルがセットアッププロセスの一部になります。特段の必要がない限り、コンパイルを自分の手で行う必要はありません。</p>
+
+<p>JSX は HTML と JavaScript がミックスされたものなので、一部の開発者にとっては直感的に使うことができます。しかしそうでない人にとってはは、そのミックスされていることで混乱させられると言います。ただし、慣れれば、ユーザーインターフェースをより迅速かつ直感的に構築できるようになり、他の人がコードを一目で理解しやすくなります。</p>
+
+<p>JSX の詳細については、React チームの <a href="https://reactjs.org/docs/jsx-in-depth.html">JSX In Depth</a> の記事をご覧ください。</p>
+
+<h2 id="Setting_up_your_first_React_app" name="Setting_up_your_first_React_app">最初の React アプリをセットアップする</h2>
+
+<p>React を使用する方法はたくさんありますが、前述のように、コマンドラインインターフェイス (CLI) ツールの create-react-app を使用します。これにより、いくつかのパッケージをインストールしていくつかを作成することにより、React アプリケーションの開発プロセスをスムーズにします。</p>
+
+<p><code><a href="/en-US/docs/Web/HTML/Element/script">&lt;script&gt;</a></code> を HTML ファイルにコピーすることで <a href="https://reactjs.org/docs/add-react-to-a-website.html">create-react-app なしでウェブサイトに React を追加する</a>ことは可能ですが、create-react-app CLI は、React アプリケーションの一般的な始め方です。これを使うことで、アプリの作成に集中でき、セットアップに煩わされなくなります。</p>
+
+<h3 id="Requirements" name="Requirements">必要条件</h3>
+
+<p>create-react-app を使用するには、<a href="https://nodejs.org/en/">Node.js</a> をインストールする必要があります。長期サポート (LTS) バージョンを使用することをお勧めします。ノードには、npm (ノードパッケージマネージャー) および npx (ノードパッケージランナー) が含まれます。</p>
+
+<p>代わりに Yarn パッケージマネージャーを使用することもできますが、この一連のチュートリアルでは npm を使用するものとします。npm と yarn の詳細については、<a href="/ja/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Package_management">パッケージ管理の基本</a>を参照してください。</p>
+
+<p>Windows を使用している場合、このチュートリアルで言及されている端末コマンドを使用するには、Unix / macOS 端末と同等のソフトウェアをインストールする必要があります。<strong>Gitbash</strong> (<a href="https://gitforwindows.org/">Windows 用</a>の <a href="https://gitforwindows.org/">git ツールセットの</a>一部として提供) または <strong><a href="https://docs.microsoft.com/en-us/windows/wsl/about">Linux 用の Windows サブシステム</a></strong> (<strong>WSL</strong>) の両方が適しています。これら、および一般的な端末コマンドの詳細については、<a href="/ja/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line">コマンドラインクラッシュコース</a>を参照してください。</p>
+
+<p>また、React と ReactDOM は、かなり近代的な一連のブラウザー (IE9 以降) でのみ機能するアプリを生成することにも注意してください。これらのチュートリアルを実行するときは、Firefox、Safari、Chrome などの最新のブラウザーを使用することをお勧めします。</p>
+
+<p>詳細については、以下も参照してください。</p>
+
+<ul>
+ <li><a href="https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/">nodejs.org の「npm とは」</a></li>
+ <li><a href="https://blog.npmjs.org/post/162869356040/introducing-npx-an-npm-package-runner">npm ブログの「npxの紹介」</a></li>
+ <li><a href="https://create-react-app.dev/">create-react-app のドキュメント</a></li>
+</ul>
+
+<h3 id="Initializing_your_app" name="Initializing_your_app">アプリの初期化</h3>
+
+<p>create-react-app は引数を 1 つ取ります。アプリに付ける名前です。create-react-app はこの名前を使用して新しいディレクトリーを作成し、その中に必要なファイルを作成します。<code>cd</code> でアプリのハードドライブ上の場所に移動したことを確認してから、ターミナルで次のコマンドを実行します。</p>
+
+<pre class="brush: bash notranslate">npx create-react-app moz-todo-react</pre>
+
+<p>これは <code>moz-todo-react</code> ディレクトリーを作成し、その中でいくつかのことを行います:</p>
+
+<ul>
+ <li>アプリの機能に不可欠な npm パッケージをインストールします。</li>
+ <li>アプリケーションを起動および提供するためのスクリプトを記述します。</li>
+ <li>基本的なアプリアーキテクチャを定義するファイルとディレクトリーの構造を作成します。</li>
+ <li>コンピュータに git がインストールされている場合、ディレクトリーを git リポジトリーとして初期化します。</li>
+</ul>
+
+<div class="blockIndicator note">
+<p><strong>注</strong>: Yarn パッケージマネージャーがインストールされている場合、create-react-app はデフォルトで npm の代わりにそれを使用します。両方のパッケージマネージャーがインストールされていて、明示的に NPM を使用したい場合、create-react-app を実行するときに <code>--use-npm</code> フラグを追加できます。</p>
+
+<pre class="brush: bash notranslate">npx create-react-app moz-todo-react --use-npm</pre>
+</div>
+
+<p>create-react-app が機能している間、端末にいくつかのメッセージが表示されますが、正常な動作です!これには数分かかる場合がありますので、お茶でも作って待ってみましょう。</p>
+
+<p>プロセスが完了したら、<code>moz-todo-react</code>ディレクトリーへ <code>cd</code> して、コマンド <code>npm start</code> を実行します。create-react-app によってインストールされたスクリプトは、localhost:3000 のローカルサーバーで提供され始め、新しいブラウザータブでアプリを開きます。ブラウザーには次のように表示されます。</p>
+
+<p><img alt="デフォルトのcreate-react-app アプリケーションを示す、Firefox MacOS のスクリーンショット、localhost:3000を開く" src="https://mdn.mozillademos.org/files/17203/default-create-react-app.png" style="border-style: solid; border-width: 1px; height: 980px; width: 1600px;"></p>
+
+<h3 id="Application_structure" name="Application_structure">アプリケーションの構造</h3>
+
+<p>create-react-app は、React アプリケーションの開発に必要なすべてのものを提供します。初期のファイル構造は次のようになります。</p>
+
+<pre class="notranslate">moz-todo-react
+├──README.md
+├──node_modules
+├──package.json
+├──package-lock.json
+├──.gitignore
+├──public
+│├──favicon.ico
+│├──index.html
+│└──manifest.json
+└──src
+ ├──App.css
+ ├──App.js
+ ├──App.test.js
+ ├──index.css
+ ├──index.js
+ ├──logo.svg
+ └──serviceWorker.js</pre>
+
+<p><strong><code>src</code></strong> ディレクトリーはアプリケーションの実態ともいえるソースことがある場所で、私たちが触るのは主にこの部分です。</p>
+
+<p><strong><code>public</code></strong> ディレクトリーには、アプリを開発している間、ブラウザーによって読み込まれるファイルが含まれています。これらの中で最も重要なのは <code>index.html</code> です。React はこのファイルにコードを挿入して、ブラウザーで実行できるようにします。create-react-app 関数に役立つマークアップが他にもいくつかあるので、何をしているのかを理解していなければ、自分で編集しないように注意してください。このファイルの要素内の <code><a href="/ja/docs/Web/HTML/Element/title">&lt;title&gt;</a></code> を変更して、アプリケーション自体のタイトルを反映させる必要があります。アクセシビリティ向上のためには正しいページタイトルが重要です。</p>
+
+<p><code>public</code> ディレクトリーは、アプリをビルドしてデプロイするときにも公開されます。このチュートリアルではデプロイ自体については説明しませんが、<a href="/ja/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Deployment">アプリのデプロイ</a>チュートリアルで説明されているものと同様のソリューションを使用できるはずです。</p>
+
+<p>この<code>package.json</code> ファイルには、Node.js / npm がプロジェクトを整理するために使用するプロジェクトに関する情報が含まれています。このファイルは React アプリケーションに固有のものではありません。create-react-app は単にそれを生成します。このチュートリアルを完了するためにこのファイルを理解する必要はまったくありませんが、詳しく知りたい場合は<a href="https://nodejs.org/en/knowledge/getting-started/npm/what-is-the-file-package-json/">「package.json ファイルとは」</a>を参照してください。</p>
+
+<h2 id="Exploring_our_first_React_component_—_&lt;App>" name="Exploring_our_first_React_component_—_&lt;App>">最初の React コンポーネント— <code>&lt;App/&gt;</code></h2>
+
+<p>React における、<strong>コンポーネント</strong>とはアプリの一部をレンダリングする再利用可能なモジュールを指します。これらのパーツは大きくても小さくてもかまいませんが、通常は明確に定義され、単一責務のもとに作られます。</p>
+
+<p>ブラウザーに表示されているように、<code>src/App.js</code> を開いて編集しましょう。このファイルには、最初のコンポーネント、<code>App</code>、その他の数行のコードが含まれています。</p>
+
+<pre class="notranslate">import React from 'react';
+import logo from './logo.svg';
+import './App.css';
+
+function App() {
+ return (
+ &lt;div className="App"&gt;
+ &lt;header className="App-header"&gt;
+ &lt;img src={logo} className="App-logo" alt="logo" /&gt;
+ &lt;p&gt;
+ Edit &lt;code&gt;src/App.js&lt;/code&gt; and save to reload.
+ &lt;/p&gt;
+ &lt;a
+ className="App-link"
+ href="https://reactjs.org"
+ target="_blank"
+ rel="noopener noreferrer"
+ &gt;
+ Learn React
+ &lt;/a&gt;
+ &lt;/header&gt;
+ &lt;/div&gt;
+ );
+}
+export default App;</pre>
+
+<p>この <code>App.js</code> ファイルは 3 つの主要な部分で構成されています。上部にいくつかの宣言されている <code><a href="/ja/docs/Web/JavaScript/Reference/Statements/import">import</a></code>、中央にある <code>App</code>、最下部にある <code><a href="/ja/docs/Web/JavaScript/Reference/Statements/export">export</a></code>。ほとんどの React コンポーネントはこのように書かれます。</p>
+
+<h3 id="Import_statements" name="Import_statements">ステートメントをインポートする</h3>
+
+<p><code>import</code> はファイルの先頭に宣言され、<code>App.js</code> が他の場所で定義されているコードを使用するのを許可します。これらをさらに詳しく見てみましょう。</p>
+
+<pre class="notranslate">import React from 'react';
+import logo from './logo.svg';
+import './App.css';</pre>
+
+<p>最初のステートメントは、React ライブラリー自体をインポートします。React は、作成する JSX を <code>React.createElement()</code> に変換するため、すべての React コンポーネントが <code>React</code> モジュールをインポートする必要があります。この手順をスキップすると、アプリケーションでエラーが発生します。</p>
+
+<p>2 番目のステートメントは、<code>'./logo.svg'</code> をインポートします。最初の <code>./</code> パスのと最後の拡張子 <code>.svg</code> に注意してください。これらはファイルがローカルであり、JavaScript ファイルではないことを示しています。実際、<code>logo.svg</code> ファイルは <code>src/</code> ディレクトリーにあります。</p>
+
+<p><code>React</code> モジュールのインポート時にパスや拡張子は記述しません—これはローカルファイルではないからです。代わりに、<code>package.json</code> ファイルに依存関係としてリストされます。このレッスンでは、この違いに注意してください。</p>
+
+<p>3番目のステートメントは、App コンポーネントに関連する CSS をインポートします。変数名も <code>from</code> ディレクティブもないことに注意してください。この特定のインポート構文は、JavaScript モジュール構文に特有のものではありません。Webpack から提供されるものです。create-react-app ツールは、すべての JavaScript ファイルをバンドルしてブラウザーに提供するために使用します。</p>
+
+<h3 id="The_App_component" name="The_App_component"><code>App</code> コンポーネント</h3>
+
+<p><code>import</code> の次に、<code>App</code> という名前の関数があります。ほとんどの JavaScript コミュニティは<code>helloWorld</code> のようなキャメルケース名を好みますが、React コンポーネントは <code>HelloWorld</code> のようなパスカルケース変数名を使用して、特定のJSX 要素が React コンポーネントであり、通常の HTML タグではないことを明確にしています。<code>App</code> 関数の名前を <code>app</code> に変更すると、ブラウザーにエラーが表示されます。</p>
+
+<p>アプリをもっと詳しく見てみましょう。</p>
+
+<pre class="notranslate">function App() {
+ return (
+ &lt;div className="App"&gt;
+ &lt;header className="App-header"&gt;
+ &lt;img src={logo} className="App-logo" alt="logo" /&gt;
+ &lt;p&gt;
+ Edit &lt;code&gt;src/App.js&lt;/code&gt; and save to reload.
+ &lt;/p&gt;
+ &lt;a
+ className="App-link"
+ href="https://reactjs.org"
+ target="_blank"
+ rel="noopener noreferrer"
+ &gt;
+ Learn React
+ &lt;/a&gt;
+ &lt;/header&gt;
+ &lt;/div&gt;
+ );
+}</pre>
+
+<p>この <code>App</code> 関数は JSX 式を返します。この式には、ブラウザーが最終的に DOM にレンダリングするものを定義します。</p>
+
+<p>HTML と同じように、<code>attribute="value"</code> のように属性をもつ要素があります。3 行目では、<code><a href="/ja/docs/Web/HTML/Element/div">&lt;div&gt;</a></code> 開始タグに <code>className</code> 属性があります。これは HTML の<code><a href="/ja/docs/Web/HTML/Global_attributes/class">class</a></code> 属性と同じですが、JSX は JavaScript であるため使用できません。<code>class</code> が予約されているためです。つまり、JavaScript ではすでにそれを使用しており、もし同様に使うと問題が発生するということです。同じような理由で、他のいくつかの HTML 属性は、HTML とは異なる方法で JSX で記述されています。</p>
+
+<p>6 行目の <code><a href="/ja/docs/Web/HTML/Element/p">&lt;p&gt;</a></code> タグを「Hello, world!」に変更して、ファイルを保存します。この変更はブラウザー <code>http://localhost:3000</code> で実行されている開発サーバーですぐにレンダリングされます。次に、<code><a href="/ja/docs/Web/HTML/Element/a">&lt;a&gt;</a></code> タグを削除して保存します。すると、「Learn React」リンクはなくなります。</p>
+
+<p>あなたの <code>App</code> コンポーネントは次のようになります。</p>
+
+<pre class="notranslate">function App() {
+ return (
+ &lt;div className="App"&gt;
+ &lt;header className="App-header"&gt;
+ &lt;img src={logo} className="App-logo" alt="logo" /&gt;
+ &lt;p&gt;
+ Hello, World!
+ &lt;/p&gt;
+ &lt;/header&gt;
+ &lt;/div&gt;
+ );
+}</pre>
+
+<h3 id="Export_statements" name="Export_statements">ステートメントのエクスポート</h3>
+
+<p><code>App.js</code> ファイルの一番下にある <code>export default App</code> は、<code>App</code> コンポーネントを他のモジュールで使用できるようにしています。</p>
+
+<h2 id="Interrogating_the_index" name="Interrogating_the_index">index を詳しくみる</h2>
+
+<p><code>src/index.js</code> を開きましょう。<code>App</code> コンポーネントを使用しているのがわかります。このファイルはアプリのエントリーポイントであり、最初は次のようになっています。</p>
+
+<pre class="notranslate">import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+import * as serviceWorker from './serviceWorker';
+
+ReactDOM.render(&lt;App /&gt;, document.getElementById('root'));
+
+// If you want your app to work offline and load faster, you can change
+// unregister() to register() below. Note this comes with some pitfalls.
+// Learn more about service workers: https://bit.ly/CRA-PWA
+serviceWorker.unregister();</pre>
+
+<p><code>App.js</code> と同様に、ファイルは、実行する必要のあるすべての JS モジュールとその他のアセットをインポートすることから始まります。<code>src/index.css</code> ではアプリ全体に適用されるグローバルスタイルを保持します。ここに、インポートされた<code>App</code>コンポーネントも確認できます。下部の <code>export</code> により、<code>App.js</code> がインポートできるようになりました。</p>
+
+<p>7 行目 <code>ReactDOM.render()</code> は 2 つの引数で React の関数を呼び出します:</p>
+
+<ul>
+ <li><code>&lt;App /&gt;</code>: この場合、レンダリングしたいコンポーネント。</li>
+ <li>内部にコンポーネントをレンダリングする DOM 要素: この場合、<code>root</code> 要素。<code>public/index.html</code> の内側を見ると、これがの <code>&lt;div&gt;</code> であり、<code>&lt;body&gt;</code> すぐ内側の要素であることがわかります。</li>
+</ul>
+
+<p>これらはすべて、<code>App</code> コンポーネントを最初のコンポーネントとして React アプリケーションをレンダリングすることを React に伝えます。</p>
+
+<div class="blockIndicator note">
+<p><strong>注</strong>: JSX では、React コンポーネントと HTML 要素には閉じスラッシュが必要です。そのまま <code>&lt;App&gt;</code> または <code>&lt;img&gt;</code> と書くとエラーが発生します。</p>
+</div>
+
+<p><a href="/ja/docs/Web/API/Service_Worker_API/Using_Service_Workers">Service Worker</a> は、アプリケーションのパフォーマンスを向上させ、ウェブアプリケーションの機能をオフラインで動作させることができる興味深いコードですが、この記事の対象ではありません。5 行目と 9 〜 12 行目を削除します。</p>
+
+<p>最終的な<code>index.js</code>ファイルは次のようになります。</p>
+
+<pre class="notranslate">import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+
+ReactDOM.render(&lt;App /&gt;, document.getElementById('root'));</pre>
+
+<h2 id="Variables_and_props" name="Variables_and_props">変数と props</h2>
+
+<p>次に、JavaScript スキルのいくつかを使用して、コンポーネントの編集と React でのデータの操作をもう少し快適にします。JSX内での変数の使用方法について説明し、データをコンポーネントに渡す方法である props を紹介します (その後、変数を使用してアクセスできます)。</p>
+
+<h3 id="JSXの変数">JSXの変数</h3>
+
+<p><code>App.js</code> に戻り、9 行目に注目しましょう。</p>
+
+<pre class="brush: js notranslate">&lt;img src = {logo} className = "App-logo" alt = "logo" /&gt;</pre>
+
+<p>ここでは、<code>&lt;img /&gt;</code> タグの <code>src</code> 属性値は中括弧で囲まれています。これは、JSX が変数を認識する方法です。React が <code>{logo}</code> を表示し、アプリの2行目のインポートを参照していることを確認してから、logo ファイルを取得してレンダリングします。</p>
+
+<p>独自の変数を作ってみましょう。<code>App</code> の return ステートメントの前に <code>const subject = 'React';</code> を追加します。すると、<code>App</code> コンポーネントは次のようになります。</p>
+
+<pre class="notranslate">function App() {
+ const subject = "React";
+ return (
+ &lt;div className="App"&gt;
+ &lt;header className="App-header"&gt;
+ &lt;img src={logo} className="App-logo" alt="logo" /&gt;
+ &lt;p&gt;
+ Hello, World!
+ &lt;/p&gt;
+ &lt;/header&gt;
+ &lt;/div&gt;
+ );
+}</pre>
+
+<p>次のように、8 行目を変更して「world」という単語の代わりに <code>subject</code> 変数を使用します。</p>
+
+<pre class="notranslate">function App() {
+ const subject = "React";
+ return (
+ &lt;div className="App"&gt;
+ &lt;header className="App-header"&gt;
+ &lt;img src={logo} className="App-logo" alt="logo" /&gt;
+ &lt;p&gt;
+ Hello, {subject}!
+ &lt;/p&gt;
+ &lt;/header&gt;
+ &lt;/div&gt;
+ );
+}</pre>
+
+<p>保存すると、「Hello、world!」の代わりにブラウザーに「Hello、React!」と表示されます。</p>
+
+<p>変数は便利ですが、設定したばかりの変数はReactの機能をあまり活用していません。そこで、propsの登場です。</p>
+
+<h3 id="Component_props" name="Component_props">コンポーネントのprops</h3>
+
+<p><strong>props</strong> はコンポーネントに渡される任意のデータです。prop はコンポーネント内に記述され、HTML属性と同じ構文を使用します — <code>prop="value"</code>。<code>index.js</code>を開き、<code>&lt;App/&gt;</code> に最初の <code>prop</code> を渡しましょう。</p>
+
+<p><code>&lt;App/&gt;</code> コンポーネントに <code>subject</code> という prop を追加して、値は <code>Clarice</code> とします。完了すると、コードは次のようになります。</p>
+
+<pre class="notranslate">ReactDOM.render(&lt;App subject="Clarice" /&gt;, document.getElementById('root'));</pre>
+
+<p><code>App.js</code> に戻り、App 関数自体をもう一度見てみましょう。この関数は次のようになっています (簡潔にするために <code>return</code> で短くしています)。</p>
+
+<pre class="notranslate">function App() {
+ const subject = "React";
+ return (
+ // return statement
+ );
+}</pre>
+
+<p><code>App</code> 関数の引数を変更して、<code>props</code> をパラメーターとして受け入れられるようにします。他のパラメーターと同様 <code>props</code> に、<code>console.log()</code> を入力して、ブラウザーのコンソールにそれを表示させます。すると、次のようになります。</p>
+
+<pre class="notranslate">function App(props) {
+ const subject = "React";
+ console.log(props);
+ return (
+ // return statement
+ );
+}</pre>
+
+<p>ファイルを保存し、ブラウザーの JavaScript コンソールを確認します。次のようなログが表示されるはずです。</p>
+
+<pre class="notranslate">Object { subject: "Clarice" }</pre>
+
+<p>オブジェクトプロパティ <code>subject</code> は、<code>&lt;App /&gt;</code> コンポーネント呼び出しに追加した <code>subject</code> プロパティに対応し、文字列 <code>Clarice</code> はその値に対応します。React のコンポーネントプロップは、常にこのようにオブジェクトに集約されます。</p>
+
+<p><code>subject</code> は props の一部です。App.js でこれを使ってみましょう。<code>subject</code> 定数を変更して、<code>React</code> という文字列として定義する代わりに <code>props.subject</code> の値を読み取るようにします。<code>console.log()</code> は必要に応じて削除することもできます。</p>
+
+<pre class="notranslate">function App(props) {
+ const subject = props.subject;
+ return (
+ // return statement
+ );
+}</pre>
+
+<p>保存すると、アプリは「Hello、Clarice!」と挨拶するはずです。<code>index.js</code> に戻り、<code>subject</code> の値を編集して保存すると、テキストが変更されます。</p>
+
+<h2 id="Summary" name="Summary">まとめ</h2>
+
+<p>これで、React をローカルでインストールする方法、スターターアプリを作成する方法、基本的にどのように機能するかなど、React の入門が終わりました。次の記事では、最初に適したアプリケーションである todo リストの作成を開始します。ただし、その前に、私たちが学んだことのいくつかをおさらいしましょう。</p>
+
+<p>React では:</p>
+
+<ul>
+ <li>コンポーネントは必要なモジュールをインポートでき、ファイルの下部でエクスポートする必要があります。</li>
+ <li>コンポーネント関数は <code>PascalCase</code> で名前が付けられます。</li>
+ <li>JSX 変数は、<code>{so}</code> のように中括弧で囲むことで読み取ることができます。</li>
+ <li>一部の JSX 属性は HTML 属性とは異なるため、JavaScript の予約語と競合しません。例えば <code>class</code>、HTML では <code>className</code> JSX に変換されます。複数単語の属性はキャメルケースであることに注意してください。</li>
+ <li>props は、コンポーネント呼び出し内の属性と同じように記述され、コンポーネントに渡されます。</li>
+</ul>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Main_features","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</p>
+
+<h2 id="In_this_module" name="In_this_module">このモジュール内</h2>
+
+<ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Introduction">Introduction to client-side frameworks</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Main_features">Framework main features</a></li>
+ <li>React
+ <ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started">Getting started with React</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning">Beginning our React todo list</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components">Componentizing our React app</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state">React interactivity: Events and state</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering">React interactivity: Editing, filtering, conditional rendering</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility">Accessibility in React</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_resources">React resources</a></li>
+ </ul>
+ </li>
+ <li>Ember
+ <ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_getting_started">Getting started with Ember</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_structure_componentization">Ember app structure and componentization</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_interactivity_events_state">Ember interactivity: Events, classes and state</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_conditional_footer">Ember Interactivity: Footer functionality, conditional rendering</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_routing">Routing in Ember</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_resources">Ember resources and troubleshooting</a></li>
+ </ul>
+ </li>
+ <li>Vue
+ <ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_getting_started">Getting started with Vue</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component">Creating our first Vue component</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_rendering_lists">Rendering a list of Vue components</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_methods_events_models">Adding a new todo form: Vue events, methods, and models</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_styling">Styling Vue components with CSS</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_computed_properties">Using Vue computed properties</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_conditional_rendering">Vue conditional rendering: editing existing todos</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_refs_focus_management">Focus management with Vue refs</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_resources">Vue resources</a></li>
+ </ul>
+ </li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_todo_list_beginning/index.html b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_todo_list_beginning/index.html
new file mode 100644
index 0000000000..debc627272
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/react_todo_list_beginning/index.html
@@ -0,0 +1,599 @@
+---
+title: React ToDoリストをはじめる
+slug: >-
+ Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning
+translation_of: >-
+ Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning
+---
+<div>
+<p>{{LearnSidebar}}</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</p>
+</div>
+
+<p class="summary"><font><font><font><font>たとえば、Reactで</font></font></font></font><font><font>概念実証</font></font><font><font><font><font>を作成する必要があるとします。これは、ユーザーが作業したいタスクを追加、編集、削除したり、タスクを削除せずに完了としてマークしたりできるアプリです。</font></font></font><font><font><font>この記事では、基本的な</font></font></font></font><code>App</code><font><font><font><font>コンポーネントの構造とスタイルを設定し、個々のコンポーネントの定義と変更に対応できるようにします。これについては後で追加します。</font></font></font></font></p>
+
+<div class="blockIndicator note">
+<p class="summary"><strong><font><font><font><font>注</font></font></font></font></strong><font><font><font><font>:コードをGoogleのバージョンと照合する必要がある場合は、</font></font></font></font><a href="https://github.com/mdn/todo-react"><font><font><font><font>todo-react</font></font></font></font></a><font><font><font><font>リポジトリでサンプルのReactアプリコードの完成版を見つけることができます。実行</font></font></font><font><font><font>中の</font></font></font></font><a href="https://mdn.github.io/todo-react-build/"><font><font><font><font>バージョン</font></font></font></font></a><font><font><font><font>については、</font></font></font><a href="https://mdn.github.io/todo-react-build/"><font><font><font>https://mdn.github .io / todo-react-build /を</font></font></font></a></font><font><font><font><font>参照してください。</font></font></font></font></p>
+</div>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row"><font><font><font><font>前提条件:</font></font></font></font></th>
+ <td>
+ <p><font><font><font><font>コア</font></font></font></font><a href="/en-US/docs/Learn/HTML"><font><font><font><font>HTML</font></font></font></font></a><font><font><font><font>、</font></font></font></font><a href="/en-US/docs/Learn/CSS"><font><font><font><font>CSS</font></font></font></font></a><font><font><font><font>、</font></font></font></font><a href="/en-US/docs/Learn/JavaScript"><font><font><font><font>JavaScriptの</font></font></font></font></a><font><font><font><font>言語に精通していること</font><font>、</font></font></font></font><a href="/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line"><font><font><font><font>ターミナル/マンドコライン</font></font></font></font></a><font><font><font><font>に関すてる知識</font></font></font><font><font><font>。</font></font></font></font></p>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row"><font><font><font><font>目的:</font></font></font></font></th>
+ <td><font><font><font><font>todoリストの</font></font></font></font><font><font><font><font>ケーススタディを紹介</font></font></font><font><font><font>し、基本的な</font></font></font></font><code>App</code><font><font><font><font>構造とスタイルを整える。</font></font></font></font></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="アプリの「ユーザーストーリー」"><font><font><font><font>アプリの「ユーザーストーリー」</font></font></font></font></h2>
+
+<p><font><font><font><font>ソフトウェア開発では、ユーザーストーリーはユーザーの観点から実行可能な目標を</font></font></font><font><font><font>指し</font></font></font><font><font><font>ます。</font></font><font><font>作業を開始する前にユーザーストーリーを定義すると、作業に集中することができます。今回、</font></font></font><font><font><font>私たちのアプリは以下のストーリーを実現する必要があります:</font></font></font></font></p>
+
+<p><font><font><font><font>ユーザーができること</font></font></font></font></p>
+
+<ul>
+ <li><font><font><font><font>タスクのリストを読むこと</font></font></font></font></li>
+ <li><font><font><font><font>マウスまたはキーボードを使用してタスクを追加すること</font></font></font></font></li>
+ <li><font><font><font><font>マウスまたはキーボードを使用して、タスクに完了のマークを付けること</font></font></font></font></li>
+ <li><font><font><font><font>マウスまたはキーボードを使用して、タスクを削除すること</font></font></font></font></li>
+ <li><font><font><font><font>マウスまたはキーボードを使用して、タスクを編集すること</font></font></font></font></li>
+ <li><font><font><font><font>タスクの特定の一部を表示する:すべてのタスク、アクティブなタスクのみ、または完了したタスクのみ。</font></font></font></font></li>
+</ul>
+
+<p><font><font><font><font>これらのストーリーに1つずつ取り組みます。</font></font></font></font></p>
+
+<h2 id="プロジェクトに入る前に現状整理"><font><font><font><font>プロジェクトに入る前に現状整理</font></font></font></font></h2>
+
+<p><font><font><font><font>create-react-appは、プロジェクトでまったく使用しないファイルをいくつか作成しています。</font></font></font></font></p>
+
+<ul>
+ <li><font><font><font><font>コンポーネントごと</font></font></font></font><code>App.js</code><font><font>の</font></font><font><font><font><font>スタイルシート</font></font></font></font><font><font><font><font>は作成しないので、</font></font></font><font><font><font>最初に</font></font></font><font>の</font><font><font><font>上部にあるインポート</font></font></font></font><code>App.css</code><font><font><font><font>を削除します。</font></font></font></font></li>
+ <li><font><font>また、</font></font><code>logo.svg</code><font><font>ファイル</font><font>を使用しない</font><font>ので、そのインポートも削除します。</font></font></li>
+</ul>
+
+<p><font><font>次に、以下のコマンドをコピーしてターミナルに貼り付け、不要なファイルをいくつか削除します。</font><font>アプリのルートディレクトリから開始していることを確認してください。</font></font></p>
+
+<pre># Move into the src directory of your project
+cd src
+# Delete a few files
+rm -- App.test.js App.css logo.svg serviceWorker.js setupTests.js
+# Move back up to the root of the project
+cd ..</pre>
+
+<p><font><font>ノート:</font></font></p>
+
+<ul>
+ <li><font><font>削除する2つのファイルは、アプリケーションのテスト用です。</font><font>ここではテストを扱いません。</font></font></li>
+ <li><font><font>上記のターミナルタスクを実行するためにサーバーを停止した場合は、</font></font><code>npm start</code><font><font>を使用してサーバーを再起動する必要があります。</font></font></li>
+</ul>
+
+<h2 id="はじめのプロジェクトコード"><font><font>はじめのプロジェクト</font></font><font><font>コード</font></font></h2>
+
+<p><font><font>このプロジェクトの開始点として、次の2つを提供します。現在持っているものを置き換えるApp関数と、アプリのスタイルを設定するCSSです。</font></font></p>
+
+<h3 id="JSX"><font><font>JSX</font></font></h3>
+
+<p><font><font>次のスニペットをクリップボードにコピーして貼り付け</font></font><code>App.js</code><font><font>、既存の</font></font><code>App()</code><font><font>関数を</font><font>置き換え</font><font>ます。</font></font></p>
+
+<pre>function App(props) {
+ return (
+ &lt;div className="todoapp stack-large"&gt;
+ &lt;h1&gt;TodoMatic&lt;/h1&gt;
+ &lt;form&gt;
+ &lt;h2 className="label-wrapper"&gt;
+ &lt;label htmlFor="new-todo-input" className="label__lg"&gt;
+ What needs to be done?
+ &lt;/label&gt;
+ &lt;/h2&gt;
+ &lt;input
+ type="text"
+ id="new-todo-input"
+ className="input input__lg"
+ name="text"
+ autoComplete="off"
+ /&gt;
+ &lt;button type="submit" className="btn btn__primary btn__lg"&gt;
+ Add
+ &lt;/button&gt;
+ &lt;/form&gt;
+ &lt;div className="filters btn-group stack-exception"&gt;
+ &lt;button type="button" className="btn toggle-btn" aria-pressed="true"&gt;
+ &lt;span className="visually-hidden"&gt;Show &lt;/span&gt;
+ &lt;span&gt;all&lt;/span&gt;
+ &lt;span className="visually-hidden"&gt; tasks&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;button type="button" className="btn toggle-btn" aria-pressed="false"&gt;
+ &lt;span className="visually-hidden"&gt;Show &lt;/span&gt;
+ &lt;span&gt;Active&lt;/span&gt;
+ &lt;span className="visually-hidden"&gt; tasks&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;button type="button" className="btn toggle-btn" aria-pressed="false"&gt;
+ &lt;span className="visually-hidden"&gt;Show &lt;/span&gt;
+ &lt;span&gt;Completed&lt;/span&gt;
+ &lt;span className="visually-hidden"&gt; tasks&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;/div&gt;
+ &lt;h2 id="list-heading"&gt;
+ 3 tasks remaining
+ &lt;/h2&gt;
+ &lt;ul
+ role="list"
+ className="todo-list stack-large stack-exception"
+ aria-labelledby="list-heading"
+ &gt;
+ &lt;li className="todo stack-small"&gt;
+ &lt;div className="c-cb"&gt;
+ &lt;input id="todo-0" type="checkbox" defaultChecked={true} /&gt;
+ &lt;label className="todo-label" htmlFor="todo-0"&gt;
+ Eat
+ &lt;/label&gt;
+ &lt;/div&gt;
+ &lt;div className="btn-group"&gt;
+ &lt;button type="button" className="btn"&gt;
+ Edit &lt;span className="visually-hidden"&gt;Eat&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;button type="button" className="btn btn__danger"&gt;
+ Delete &lt;span className="visually-hidden"&gt;Eat&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;/div&gt;
+ &lt;/li&gt;
+ &lt;li className="todo stack-small"&gt;
+ &lt;div className="c-cb"&gt;
+ &lt;input id="todo-1" type="checkbox" /&gt;
+ &lt;label className="todo-label" htmlFor="todo-1"&gt;
+ Sleep
+ &lt;/label&gt;
+ &lt;/div&gt;
+ &lt;div className="btn-group"&gt;
+ &lt;button type="button" className="btn"&gt;
+ Edit &lt;span className="visually-hidden"&gt;Sleep&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;button type="button" className="btn btn__danger"&gt;
+ Delete &lt;span className="visually-hidden"&gt;Sleep&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;/div&gt;
+ &lt;/li&gt;
+ &lt;li className="todo stack-small"&gt;
+ &lt;div className="c-cb"&gt;
+ &lt;input id="todo-2" type="checkbox" /&gt;
+ &lt;label className="todo-label" htmlFor="todo-2"&gt;
+ Repeat
+ &lt;/label&gt;
+ &lt;/div&gt;
+ &lt;div className="btn-group"&gt;
+ &lt;button type="button" className="btn"&gt;
+ Edit &lt;span className="visually-hidden"&gt;Repeat&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;button type="button" className="btn btn__danger"&gt;
+ Delete &lt;span className="visually-hidden"&gt;Repeat&lt;/span&gt;
+ &lt;/button&gt;
+ &lt;/div&gt;
+ &lt;/li&gt;
+ &lt;/ul&gt;
+ &lt;/div&gt;
+ );
+}</pre>
+
+<p><font><font>次に</font></font><code>public/index.html</code>を開いて<font><font>、</font></font><code><a href="/en-US/docs/Web/HTML/Element/title">&lt;title&gt;</a></code><font><font>要素のテキストを</font><font>開い</font><font>て</font></font><code>TodoMatic</code><font><font>に変更します。</font><font>こうすることでアプリ上部の</font></font><code><a href="/en-US/docs/Web/HTML/Element/Heading_Elements">&lt;h1&gt;</a></code><font><font>と一致し</font><font>ます。</font></font></p>
+
+<pre>&lt;title&gt;TodoMatic&lt;/title&gt;</pre>
+
+<p><font><font>ブラウザが更新されると、次のように表示されます。</font></font></p>
+
+<p><img alt="todo-maticアプリ、スタイルなし、乱雑なラベル、入力、ボタンの混乱を表示" src="https://mdn.mozillademos.org/files/17253/unstyled-app.png" style="border-style: solid; border-width: 1px; height: 743px; width: 838px;"></p>
+
+<p><font><font>まだ見た目が整っていなくて、機能もしていませんが、一旦問題はありません。すぐにスタイルを設定します。</font><font>まず、このJSXと、それがユーザーストーリーにどのように対応するかを考えます。</font></font></p>
+
+<ul>
+ <li><font><font>新しいタスクを書き込むためのと、フォームを送信するためのボタン</font><font>を備えた</font></font><code><a href="/en-US/docs/Web/HTML/Element/form">&lt;form&gt;</a></code>と<code><a href="/en-US/docs/Web/HTML/Element/input/text">&lt;input type="text"&gt;</a></code><font><font>要素があります。</font></font></li>
+ <li><font><font>タスクのフィルタリングに使用するボタンの配列があります。</font></font></li>
+ <li><font><font>残っているタスクの数を示す見出しがあります。</font></font></li>
+ <li><font><font>3つのタスクがあり、順序付けられていないリストに配置されています。</font><font>各タスクはリストアイテム(</font></font><code><a href="/en-US/docs/Web/HTML/Element/li">&lt;li&gt;</a></code><font><font>)であり、</font><font>タスク</font><font>を編集および削除するためのボタンと、完了時にチェックボックスをオンにするチェックボックスがあります。</font></font></li>
+</ul>
+
+<p><font><font>このフォームにより</font></font><em><font><font>、</font></font></em><font><font>タスク</font><font>を作成できます。また、</font><font>ボタンでフィルタリングもで</font></font><font><font>きます。</font><font>見出しとリストは、</font><font>それら</font><font>を読むためのものです</font><font>。</font><font>現在のところ、タスク</font><font>を編集するためのUIはあまりよくありません</font><font>。大丈夫です。後ほど書き足していきます。</font></font></p>
+
+<h3 id="アクセシビリティ"><font><font>アクセシビリティ</font></font></h3>
+
+<p><font><font>ここでいくつかの変わった属性に気付くかもしれません。</font><font>例えば:</font></font></p>
+
+<pre>&lt;button type="button" className="btn toggle-btn" aria-pressed="true"&gt;
+ &lt;span className="visually-hidden"&gt;Show &lt;/span&gt;
+ &lt;span&gt;all&lt;/span&gt;
+ &lt;span className="visually-hidden"&gt; tasks&lt;/span&gt;
+&lt;/button&gt;</pre>
+
+<p><font><font>ここでは、</font></font><code>aria-pressed</code><font><font>ボタンは2つの状態のいずれかであることができることを(スクリーンリーダーなど)技術的に伝えます(</font></font><code>pressed</code><font><font>か</font></font><code>unpressed</code>)<font><font>。</font></font><code>on</code><font><font>と</font></font><code>off</code>の切替のように考えられます。<code>true</code><font><font>の値を設定</font></font><font><font>すると、デフォルトでボタンが押されます。</font></font></p>
+
+<p><font><font>CSSが含まれていないため、</font><font>この</font></font><code>visually-hidden</code><font><font>クラス</font><font>はまだ意味がありません。</font><font>ただし、スタイルを設定すると、このクラスの要素はすべて、目の見えるユーザーからは隠され、スクリーンリーダーのユーザーは引き続き使用できます。これは、目の見えるユーザーがこれらの単語を必要としないためです。</font><font>それらは、ボタンを使用してスクリーンリーダーのユーザーに役立つ追加の視覚的コンテキストがないユーザーのために、ボタンの機能に関する詳細情報を提供するためにあります。</font></font></p>
+
+<p><font><font>さらに下には</font></font><code><a href="/en-US/docs/Web/HTML/Element/ul">&lt;ul&gt;</a></code><font><font>要素</font><font>があります</font><font>:</font></font></p>
+
+<pre>&lt;ul
+ role="list"
+ className="todo-list stack-large stack-exception"
+ aria-labelledby="list-heading"
+&gt;</pre>
+
+<p><code>role</code><font><font>属性は、タグが表す要素の種類を説明するのに役立ちます。</font></font><code>&lt;ul&gt;</code><font><font>はデフォルトではリストのように扱われますが、これから追加するスタイルはその機能を壊します。</font><font>この役割は、</font></font><code>&lt;ul&gt;</code><font><font>  要素の</font><font>「リスト」の意味を復元し</font><font>ます。</font><font>これが必要な理由について詳しく知りたい場合は、</font></font><font><font><a href="https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html">Scott O'Haraの記事「Fixing Lists」</a>を</font></font><font><font>チェックしてください</font><font>。</font></font></p>
+
+<p><font><font>この</font></font><code>aria-labelledby</code><font><font>属性は、リストの見出しをその下にあるリストの目的を説明するラベルとして扱っていることを伝えます。</font><font>この関連付けを行うと、リストの情報が豊富になり、スクリーンリーダーを通じてユーザーがリストの目的を理解しやすくなります。</font></font></p>
+
+<p><font><font>最後に、リスト項目のラベルと入力には、JSXに固有のいくつかの属性があります。</font></font></p>
+
+<pre>&lt;input id="todo-0" type="checkbox" defaultChecked={true} /&gt;
+&lt;label className="todo-label" htmlFor="todo-0"&gt;
+ Eat
+&lt;/label&gt;</pre>
+
+<p><code>&lt;input/ &gt;</code><font><font>タグ</font><font>の</font></font><code>defaultChecked</code><font><font>属性は、デフォルトで</font></font><font><font>このチェックボックスをチェックするようにReactに指示します。通常のHTMLの場合</font><font>と同様に、</font></font><code>checked</code><font><font>を使用する</font><font>と、Reactは、チェックボックスでのイベントの処理に関する警告をブラウザーコンソールに表示しますが、これは望ましくありません。</font><font>とりあえず、これについてあまり心配しないでください。後でイベントを使用するときにこれについて説明します。</font></font></p>
+
+<p><font><font>この</font></font><code>htmlFor</code><font><font>属性は、HTMLで使用される</font></font><code>for</code><font><font>属性に対応してい</font><font>ます。</font></font><code>for</code><font><font>は予約語であるため、JSXでは属性として</font><font>使用できません</font><font>。そのためReactは</font></font><code>for</code>の代わりに<code>htmlFor</code><font><font>を使用し</font><font>ます。</font></font></p>
+
+<p><font><font>ノート:</font></font></p>
+
+<ul>
+ <li><font><font>JSX属性で</font><font>ブール値(</font></font><code>true</code><font><font>および</font></font><code>false</code><font><font>)</font><font>を使用するには</font><font>、それらを中括弧で囲む必要があります。</font><font>あなたが書く場合は</font></font><code>defaultChecked="true"</code><font><font>、の値は</font></font><code>defaultChecked</code><font><font>ではなくなり、文字列リテラル</font></font><code>"true"</code><font><font>になります。覚えておいてください—これは実際にはHTMLではなくJavaScriptです!</font></font></li>
+ <li>先ほどのコードで使われたいた<code>aria-pressed</code>属性は<code>"true"</code>をもっていましたが、これはcheckedのようにブール値としてのtrueではありません。</li>
+</ul>
+
+<h3 id="スタイルを実装する"><font><font>スタイルを実装する</font></font></h3>
+
+<p><font><font>次のCSSコードをに貼り付けて、</font></font><code>src/index.css</code>を<font><font>現在あるものを置き換えます。</font></font></p>
+
+<pre>/* RESETS */
+*,
+*::before,
+*::after {
+ box-sizing: border-box;
+}
+*:focus {
+ outline: 3px dashed #228bec;
+ outline-offset: 0;
+}
+html {
+ font: 62.5% / 1.15 sans-serif;
+}
+h1,
+h2 {
+ margin-bottom: 0;
+}
+ul {
+ list-style: none;
+ padding: 0;
+}
+button {
+ border: none;
+ margin: 0;
+ padding: 0;
+ width: auto;
+ overflow: visible;
+ background: transparent;
+ color: inherit;
+ font: inherit;
+ line-height: normal;
+ -webkit-font-smoothing: inherit;
+ -moz-osx-font-smoothing: inherit;
+ -webkit-appearance: none;
+}
+button::-moz-focus-inner {
+ border: 0;
+}
+button,
+input,
+optgroup,
+select,
+textarea {
+ font-family: inherit;
+ font-size: 100%;
+ line-height: 1.15;
+ margin: 0;
+}
+button,
+input {
+ overflow: visible;
+}
+input[type="text"] {
+ border-radius: 0;
+}
+body {
+ width: 100%;
+ max-width: 68rem;
+ margin: 0 auto;
+ font: 1.6rem/1.25 Arial, sans-serif;
+ background-color: #f5f5f5;
+ color: #4d4d4d;
+}
+@media screen and (min-width: 620px) {
+ body {
+ font-size: 1.9rem;
+ line-height: 1.31579;
+ }
+}
+/*END RESETS*/
+/* GLOBAL STYLES */
+.form-group &gt; input[type="text"] {
+ display: inline-block;
+ margin-top: 0.4rem;
+}
+.btn {
+ padding: 0.8rem 1rem 0.7rem;
+ border: 0.2rem solid #4d4d4d;
+ cursor: pointer;
+ text-transform: capitalize;
+}
+.btn.toggle-btn {
+ border-width: 1px;
+ border-color: #d3d3d3;
+}
+.btn.toggle-btn[aria-pressed="true"] {
+ text-decoration: underline;
+ border-color: #4d4d4d;
+}
+.btn__danger {
+ color: #fff;
+ background-color: #ca3c3c;
+ border-color: #bd2130;
+}
+.btn__filter {
+ border-color: lightgrey;
+}
+.btn__primary {
+ color: #fff;
+ background-color: #000;
+}
+.btn-group {
+ display: flex;
+ justify-content: space-between;
+}
+.btn-group &gt; * {
+ flex: 1 1 49%;
+}
+.btn-group &gt; * + * {
+ margin-left: 0.8rem;
+}
+.label-wrapper {
+ margin: 0;
+ flex: 0 0 100%;
+ text-align: center;
+}
+.visually-hidden {
+ position: absolute !important;
+ height: 1px;
+ width: 1px;
+ overflow: hidden;
+ clip: rect(1px 1px 1px 1px);
+ clip: rect(1px, 1px, 1px, 1px);
+ white-space: nowrap;
+}
+[class*="stack"] &gt; * {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+.stack-small &gt; * + * {
+ margin-top: 1.25rem;
+}
+.stack-large &gt; * + * {
+ margin-top: 2.5rem;
+}
+@media screen and (min-width: 550px) {
+ .stack-small &gt; * + * {
+ margin-top: 1.4rem;
+ }
+ .stack-large &gt; * + * {
+ margin-top: 2.8rem;
+ }
+}
+.stack-exception {
+ margin-top: 1.2rem;
+}
+/* END GLOBAL STYLES */
+.todoapp {
+ background: #fff;
+ margin: 2rem 0 4rem 0;
+ padding: 1rem;
+ position: relative;
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 2.5rem 5rem 0 rgba(0, 0, 0, 0.1);
+}
+@media screen and (min-width: 550px) {
+ .todoapp {
+ padding: 4rem;
+ }
+}
+.todoapp &gt; * {
+ max-width: 50rem;
+ margin-left: auto;
+ margin-right: auto;
+}
+.todoapp &gt; form {
+ max-width: 100%;
+}
+.todoapp &gt; h1 {
+ display: block;
+ max-width: 100%;
+ text-align: center;
+ margin: 0;
+ margin-bottom: 1rem;
+}
+.label__lg {
+ line-height: 1.01567;
+ font-weight: 300;
+ padding: 0.8rem;
+ margin-bottom: 1rem;
+ text-align: center;
+}
+.input__lg {
+ padding: 2rem;
+ border: 2px solid #000;
+}
+.input__lg:focus {
+ border-color: #4d4d4d;
+ box-shadow: inset 0 0 0 2px;
+}
+[class*="__lg"] {
+ display: inline-block;
+ width: 100%;
+ font-size: 1.9rem;
+}
+[class*="__lg"]:not(:last-child) {
+ margin-bottom: 1rem;
+}
+@media screen and (min-width: 620px) {
+ [class*="__lg"] {
+ font-size: 2.4rem;
+ }
+}
+.filters {
+ width: 100%;
+ margin: unset auto;
+}
+/* Todo item styles */
+.todo {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+}
+.todo &gt; * {
+ flex: 0 0 100%;
+}
+.todo-text {
+ width: 100%;
+ min-height: 4.4rem;
+ padding: 0.4rem 0.8rem;
+ border: 2px solid #565656;
+}
+.todo-text:focus {
+ box-shadow: inset 0 0 0 2px;
+}
+/* CHECKBOX STYLES */
+.c-cb {
+ box-sizing: border-box;
+ font-family: Arial, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ font-weight: 400;
+ font-size: 1.6rem;
+ line-height: 1.25;
+ display: block;
+ position: relative;
+ min-height: 44px;
+ padding-left: 40px;
+ clear: left;
+}
+.c-cb &gt; label::before,
+.c-cb &gt; input[type="checkbox"] {
+ box-sizing: border-box;
+ top: -2px;
+ left: -2px;
+ width: 44px;
+ height: 44px;
+}
+.c-cb &gt; input[type="checkbox"] {
+ -webkit-font-smoothing: antialiased;
+ cursor: pointer;
+ position: absolute;
+ z-index: 1;
+ margin: 0;
+ opacity: 0;
+}
+.c-cb &gt; label {
+ font-size: inherit;
+ font-family: inherit;
+ line-height: inherit;
+ display: inline-block;
+ margin-bottom: 0;
+ padding: 8px 15px 5px;
+ cursor: pointer;
+ touch-action: manipulation;
+}
+.c-cb &gt; label::before {
+ content: "";
+ position: absolute;
+ border: 2px solid currentColor;
+ background: transparent;
+}
+.c-cb &gt; input[type="checkbox"]:focus + label::before {
+ border-width: 4px;
+ outline: 3px dashed #228bec;
+}
+.c-cb &gt; label::after {
+ box-sizing: content-box;
+ content: "";
+ position: absolute;
+ top: 11px;
+ left: 9px;
+ width: 18px;
+ height: 7px;
+ transform: rotate(-45deg);
+ border: solid;
+ border-width: 0 0 5px 5px;
+ border-top-color: transparent;
+ opacity: 0;
+ background: transparent;
+}
+.c-cb &gt; input[type="checkbox"]:checked + label::after {
+ opacity: 1;
+}</pre>
+
+<p><font><font>保存してブラウザーを確認すると、アプリに適切なスタイルが設定されているはずです。</font></font></p>
+
+<h2 id="まとめ">まとめ</h2>
+
+<p><font><font>これで、todoリストアプリはまるで実際のアプリのように見えます。</font><font>問題は、実際には何も動かないことです。</font><font>次の章で修正を始めます!</font></font></p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</p>
+
+<h2 id="In_this_module">In this module</h2>
+
+<ul>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Introduction">Introduction to client-side frameworks</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Main_features">Framework main features</a></li>
+ <li>React
+ <ul>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started">Getting started with React</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning">Beginning our React todo list</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components">Componentizing our React app</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state">React interactivity: Events and state</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering">React interactivity: Editing, filtering, conditional rendering</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility">Accessibility in React</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_resources">React resources</a></li>
+ </ul>
+ </li>
+ <li>Ember
+ <ul>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_getting_started">Getting started with Ember</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_structure_componentization">Ember app structure and componentization</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_interactivity_events_state">Ember interactivity: Events, classes and state</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_conditional_footer">Ember Interactivity: Footer functionality, conditional rendering</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_routing">Routing in Ember</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_resources">Ember resources and troubleshooting</a></li>
+ </ul>
+ </li>
+ <li>Vue
+ <ul>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_getting_started">Getting started with Vue</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component">Creating our first Vue component</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_rendering_lists">Rendering a list of Vue components</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_methods_events_models">Adding a new todo form: Vue events, methods, and models</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_styling">Styling Vue components with CSS</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_computed_properties">Using Vue computed properties</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_conditional_rendering">Vue conditional rendering: editing existing todos</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_refs_focus_management">Focus management with Vue refs</a></li>
+ <li><a href="https://wiki.developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_resources">Vue resources</a></li>
+ </ul>
+ </li>
+</ul>
+
+<ul>
+ <li>
+ <ul>
+ <li></li>
+ </ul>
+ </li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/vue_getting_started/index.html b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/vue_getting_started/index.html
new file mode 100644
index 0000000000..4277a7ba9d
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/client-side_javascript_frameworks/vue_getting_started/index.html
@@ -0,0 +1,301 @@
+---
+title: Getting started with Vue
+slug: Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_getting_started
+tags:
+ - Beginner
+ - Frameworks
+ - Installation
+ - JavaScript
+ - Learn
+ - client-side
+ - vue
+translation_of: Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_getting_started
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_resources","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</div>
+
+<p class="summary">Now let's introduce Vue, the third of our frameworks. In this article we'll look at a little bit of Vue background, learn how to install it and create a new project, study the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to start building our example.</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td>
+ <p>Familiarity with the core <a href="/en-US/docs/Learn/HTML">HTML</a>, <a href="/en-US/docs/Learn/CSS">CSS</a>, and <a href="/en-US/docs/Learn/JavaScript">JavaScript</a> languages, knowledge of the <a href="/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line">terminal/command line</a>.</p>
+
+ <p>Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed.</p>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row">Objective:</th>
+ <td>To setup a local Vue development environment, create a starter app, and understand the basics of how it works.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="より明確な_Vue">より明確な Vue</h2>
+
+<p>Vue is a modern JavaScript framework that provides useful facilities for progressive enhancement — unlike many other frameworks, you can use Vue to enhance existing HTML. This lets you use Vue as a drop-in replacement for a library like <a href="/en-US/docs/Glossary/jQuery">JQuery</a>.</p>
+
+<p>That being said, you can also use Vue to write entire Single Page Applications (SPAs). This allows you to create markup managed entirely by Vue, which can improve developer experience and performance when dealing with complex applications. It also allows you to take advantage of libraries for client-side routing and state management when you need to. Additionally, Vue takes a "middle ground" approach to tooling like client-side routing and state management. While the Vue core team maintains suggested libraries for these functions, they are not directly bundled into Vue. This allows you to select a different routing/state management library if they better fit your application.</p>
+
+<p>In addition to allowing you to progressively integrate Vue into your applications, Vue also provides a progressive approach to writing markup. Like most frameworks, Vue lets you create reusable blocks of markup via components. Most of the time, Vue components are written using a special HTML template syntax. When you need more control than the HTML syntax allows, you can write JSX or plain JavaScript functions to define your  components.</p>
+
+<p>As you work through this tutorial, you might want to keep the <a href="https://vuejs.org/v2/guide/">Vue guide</a> and <a href="https://vuejs.org/v2/api/">API documentation</a> open in other tabs, so you can refer to them if you want more information on any sub topic.<br>
+ For a good (but potentially biased) comparison between Vue and many of the other frameworks, see <a href="https://vuejs.org/v2/guide/comparison.html">Vue Docs: Comparison with Other Frameworks</a>.</p>
+
+<h2 id="取り付け">取り付け</h2>
+
+<p>To use Vue in an existing site, you can drop one of the following <code><a href="/en-US/docs/Web/HTML/Element/script">&lt;script&gt;</a></code> elements onto a page. This allows you to start using Vue on existing sites, which is why Vue prides itself on being a progressive framework. This is a great option when migrating an existing project using a library like JQuery to Vue. With this method, you can use a lot of the core features of Vue, such as the attributes, custom components, and data-management.</p>
+
+<ul>
+ <li>
+ <p>Development Script (Unoptimized, but includes console warnings. Great for development</p>
+
+ <pre class="brush: html notranslate">&lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&gt;&lt;/script&gt;</pre>
+ </li>
+ <li>
+ <p>Production Script (Optimized version, minimal console warnings. It is recommended that you specify a version number when including Vue on your site so that any framework updates do not break your live site without you knowing.)</p>
+
+ <pre class="brush: html notranslate">&lt;script src="https://cdn.jsdelivr.net/npm/vue@2"&gt;&lt;/script&gt;</pre>
+ </li>
+</ul>
+
+<p>However, this approach has some limitations. To build more complex apps, you’ll want to use the <a href="https://www.npmjs.com/package/vue">Vue NPM package</a>. This will let you use advanced features of Vue and take advantage of bundlers like WebPack. To make building apps with Vue easier, there is a CLI to streamline the development process. To use the npm package &amp; the CLI you will need:</p>
+
+<ol>
+ <li>Node.js 8.11+ installed.</li>
+ <li>npm or yarn.</li>
+</ol>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: If you don't have the above installed, find out <a href="/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line#Adding_powerups">more about installing npm and Node.js</a> here.</p>
+</div>
+
+<p>To install the CLI, run the following command in your terminal:</p>
+
+<pre class="brush: bash notranslate">npm install --global @vue/cli</pre>
+
+<p>Or if you'd prefer to use yarn:</p>
+
+<pre class="brush: bash notranslate">yarn global add @vue/cli</pre>
+
+<p>Once installed, to initialize a new project you can then open a terminal in the directory you want to create the project in, and run <code>vue create &lt;project-name&gt;</code>. The CLI will then give you a list of project configurations you can use. There are a few preset ones, and you can make your own. These options let you configure things like TypeScript, linting, vue-router, testing, and more.</p>
+
+<p>We’ll look at using this below.</p>
+
+<h2 id="新規のプロジェクトを初期化する">新規のプロジェクトを初期化する</h2>
+
+<p>To explore various features of Vue, we will be building up a sample todo list app. We'll begin by using the Vue CLI to create a new app framework to build our app into. Follow the steps below:</p>
+
+<ol>
+ <li>In terminal, <code>cd</code> to where you'd like to create your sample app, then run <code>vue create moz-todo-vue</code>.</li>
+ <li>Use the arrow keys and <kbd>Enter</kbd> to select the "Manually select features" option.</li>
+ <li>The first menu you’ll be presented with allows you to choose which features you want to include in your project. Make sure that "Babel" and "Linter / Formatter" are selected. If they are not, use the arrow keys and the space bar to toggle them on. Once they are selected, press <kbd>Enter</kbd> to proceed.</li>
+ <li>Next you’ll select a config for the linter / formatter. Navigate to "Eslint with error prevention only" and hit <kbd>Enter</kbd> again. This will help us catch common errors, but not be overly opinionated.</li>
+ <li>Next you are asked to configure what kind of automated linting we want. Select "Lint on save". This will check for errors when we save a file inside the project. Hit <kbd>Enter</kbd> to continue.</li>
+ <li>Now, you will select how we want your config files to be managed. "In dedicated config files" will put your config settings for things like ESLint into their own, dedicated files. The other option, "In package.json", will put all of your config settings into the app's <code>package.json</code> file. Select "In dedicated config files" and push <kbd>Enter</kbd>.</li>
+ <li>Finally, you are asked if you want to save this as a preset for future options. This is entirely up to you. If you like these settings over the existing presets and want to use them again, type <kbd>y</kbd> , otherwise type <kbd>n</kbd>.</li>
+</ol>
+
+<p>The CLI will now begin scaffolding out your project, and installing all of your dependencies.</p>
+
+<p>If you've never run the Vue CLI before, you'll get one more question — you'll be asked to choose a package manager. You can use the arrow keys to select which one you prefer. The Vue CLI will default to this package manager from now on. If you need to use a different package manager after this, you can pass in a flag <code>--packageManager=&lt;package-manager&gt;</code>, when you run <code>vue create</code>.  So if you wanted to create the <code>moz-todo-vue</code> project with npm and you'd previously chosen yarn, you’d run <code>vue create moz-todo-vue --packageManager=npm</code>.</p>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: We've not gone over all of the options here, but you can <a href="https://cli.vuejs.org">find more information on the CLI</a> in the Vue docs.</p>
+</div>
+
+<h2 id="プロジェクトの構造">プロジェクトの構造</h2>
+
+<p>If everything went successfully, the CLI should have created a series of files and directories for your project. The most significant ones are as follows:</p>
+
+<ul>
+ <li><code>.eslintrc.js</code>: This is a config file for <a href="https://eslint.org/">eslint</a>. You can use this to manage your linting rules.</li>
+ <li><code>babel.config.js</code>: This is the config file for <a href="https://babeljs.io/">Babel</a>, which transforms modern JavaScript features being used in development code into older syntax that is more cross-browser compatible in production code. You can register additional babel plugins in this file.</li>
+ <li><code>.browserslistrc</code>: This is a config for <a href="https://github.com/browserslist/browserslist">Browserslist</a>. You can use this to control which browsers your tooling optimizes for.</li>
+ <li><code>public</code>: This directory contains static assets that are published, but not processed by <a href="https://webpack.js.org/">Webpack</a> during build (with one exception; <code>index.html</code> gets some processing).
+ <ul>
+ <li><code>favicon.ico</code>: This is the favicon for your app. Currently, it's the Vue logo.</li>
+ <li><code>index.html</code>: This is the template for your app. Your Vue app is run from this HTML page, and you can use lodash template syntax to interpolate values into it.
+ <div class="note"><strong>Note</strong>: this is not the template for managing the layout of your application — this template is for managing static HTML that sits outside of your Vue app. Editing this file typically only occurs in advanced use cases.</div>
+ </li>
+ </ul>
+ </li>
+ <li><code>src</code>: This directory contains the core of your Vue app.
+ <ul>
+ <li><code>main.js</code>: this is the entry point to your application. Currently, this file initializes your Vue application and signifies which HTML element in the <code>index.html</code> file your app should be attached to. This file is often where you register global components or additional Vue libraries.</li>
+ <li><code>App.vue</code>: this is the top-level component in your Vue app. See below for more explanation of Vue components.</li>
+ <li><code>components</code>: this directory is where you keep your components. Currently it just has one example component.</li>
+ <li><code>assets</code>: This directory is for storing static assets like CSS and images. Because these files are in the source directory, they can be processed by Webpack. This means you can use pre-processors like <a href="https://sass-lang.com/">Sass/SCSS</a> or <a href="https://stylus-lang.com/">Stylus</a>.</li>
+ </ul>
+ </li>
+</ul>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: Depending on the options you select when creating a new project, there might be other directories present (for example, if you choose a router, you will also have a <code>views</code> directory).</p>
+</div>
+
+<h2 id=".vue_ファイル_単一ファイルコンポーネント">.vue ファイル (単一ファイルコンポーネント)</h2>
+
+<p>Like in many front-end frameworks, components are a central part of building apps in Vue. These components let you break a large application into discrete building blocks that can be created and managed separately, and transfer data between each other as required. These small blocks can help you reason about and test your code.</p>
+
+<p>While some frameworks encourage you to separate your template, logic, and styling code into separate files, Vue takes the opposite approach. Using <a href="https://vuejs.org/v2/guide/single-file-components.html">Single File Components</a>, Vue lets you group your templates, corresponding script, and CSS all together in a single file ending in <code>.vue</code>. These files are processed by a JS build tool (such as Webpack), which means you can take advantage of build-time tooling in your project. This allows you to use tools like Babel, TypeScript, SCSS and more to create more sophisticated components.</p>
+
+<p>As a bonus, projects created with the Vue CLI are configured to use <code>.vue</code> files with Webpack out of the box. In fact, if you look inside the <code>src</code> folder in the project we created with the CLI, you'll see your first <code>.vue</code> file: <code>App.vue</code>.</p>
+
+<p>Let's explore this now.</p>
+
+<h3 id="App.vue">App.vue</h3>
+
+<p>Open your <code>App.vue</code> file — you’ll see that it has three parts: <code>&lt;template&gt;</code>, <code>&lt;script&gt;</code>, and <code>&lt;style&gt;</code>, which contain the component’s template, scripting, and styling information. All Single File Components share this same basic structure.</p>
+
+<p><code>&lt;template&gt;</code> contains all the markup structure and display logic of your component. Your template can contain any valid HTML, as well as some Vue-specific syntax that we'll cover later.</p>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: By setting the <code>lang</code> attribute on the <code>&lt;template&gt;</code> tag, you can use Pug template syntax instead of standard HTML — <code>&lt;template lang="pug"&gt;</code>. We'll stick to standard HTML through this tutorial, but it is worth knowing that this is possible.</p>
+</div>
+
+<p><code>&lt;script&gt;</code> contains all of the non-display logic of your component. Most importantly, your <code>&lt;script&gt;</code> tag needs to have a default exported JS object. This object is where you locally register components, define component inputs (props), handle local state, define methods, and more. Your build step will process this object and transform it (with your template) into a Vue component with a <code>render()</code> function.</p>
+
+<p>In the case of <code>App.vue</code>, our default export sets the name of the component to <code>app</code> and registers the <code>HelloWorld</code> component by adding it into the <code>components</code> property. When you register a component in this way, you're registering it locally. Locally registered components can only be used inside the components that register them, so you need to import and register them in every component file that uses them. This can be useful for bundle splitting/tree shaking since not every page in your app necessarily needs every component.</p>
+
+<pre class="brush: js notranslate">import HelloWorld from './components/HelloWorld.vue';
+
+export default {
+ name: 'app',
+ components: {
+ //You can register components locally here.
+ HelloWorld
+ }
+};</pre>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: If you want to use <a href="https://www.typescriptlang.org/">TypeScript</a> syntax, you need to set the <code>lang</code> attribute on the <code>&lt;script&gt;</code> tag to signify to the compiler that you're using TypeScript — <code>&lt;script lang="ts"&gt;</code>.</p>
+</div>
+
+<p><code>&lt;style&gt;</code> is where you write your CSS for the component. If you add a <code>scoped</code> attribute — <code>&lt;style scoped&gt;</code> — Vue will scope the styles to the contents of your SFC. This works similar to CSS-in-JS solutions, but allows you to just write plain CSS.</p>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: If you select a CSS pre-processor when creating the project via the CLI, you can add a <code>lang</code> attribute to the <code>&lt;style&gt;</code> tag so that the contents can be processed by Webpack at build time. For example, <code>&lt;style lang="scss"&gt;</code> will allow you to use SCSS syntax in your styling information.</p>
+</div>
+
+<h2 id="アプリをローカルで実行する">アプリをローカルで実行する</h2>
+
+<p>The Vue CLI comes with a built-in development server. This allows you to run your app locally so you can test it easily without needing to configure a server yourself. The CLI adds a <code>serve</code> command to the project’s <code>package.json</code> file as an npm script, so you can easily run it.</p>
+
+<p>In your terminal, try running <code>npm run serve</code> (or <code>yarn serve</code> if you prefer yarn). Your terminal should output something like the following:</p>
+
+<pre class="notranslate">INFO Starting development server...
+98% after emitting CopyPlugin
+
+ DONE Compiled successfully in 18121ms
+
+ App running at:
+ - Local: &lt;http://localhost:8080/&gt;
+ - Network: &lt;http://192.168.1.9:8080/&gt;
+
+ Note that the development build is not optimized.
+ To create a production build, run npm run build.</pre>
+
+<p>If you navigate to the “local” address in a new browser tab (this should be something like <code>http://localhost:8080</code> as stated above, but may vary based on your setup), you should see your app. Right now, it should contain a welcome message, a link to the Vue documentation, links to the plugins you added when you initialized the app with your CLI, and some other useful links to the Vue community and ecosystem.</p>
+
+<p><img alt="default vue app render, with vue logo, welcome message, and some documentation links" src="https://mdn.mozillademos.org/files/17240/vue-default-app.png" style="border-style: solid; border-width: 1px; height: 779px; width: 1600px;"></p>
+
+<h2 id="いくつかの変更を加える">いくつかの変更を加える</h2>
+
+<p>Let's make our first change to the app — we’ll delete the Vue logo. Open the <code>App.vue</code> file, and delete the <code><a href="/en-US/docs/Web/HTML/Element/img">&lt;img&gt;</a></code> element from the template section:</p>
+
+<pre class="brush: html notranslate"><span class="author-d-iz88z86z86za0dz67zz78zz78zz74zz68zjz80zz71z9iz90z8h7gz67ziz76zcz77zz80zz71zncfz69zz69ziaz82zz71zz72zhz77zz122zz90z14mcyd">&lt;img alt="Vue logo" src="./assets/logo.png"&gt;</span></pre>
+
+<p>If your server is still running, you should see the logo removed from the rendered site almost instantly. Let’s also remove the <code>HelloWorld</code> component from our template.</p>
+
+<p>First of all delete this line:</p>
+
+<pre class="brush: html notranslate">&lt;HelloWorld msg="Welcome to Your Vue.js App"/&gt;</pre>
+
+<p>If you save your <code>App.vue</code> file now, the rendered app will throw an error because we’ve registered the component but are not using it. We also need to remove the lines from inside the <code>&lt;script&gt;</code> element that import and register the component:</p>
+
+<p>Delete these lines now:</p>
+
+<pre class="brush: js notranslate">import HelloWorld from './components/HelloWorld.vue'</pre>
+
+<pre class="brush: js notranslate">components: {
+ HelloWorld
+}</pre>
+
+<p>Your rendered app should no longer show an error, just a blank page, as we currently have no visible content inside <code>&lt;template&gt;</code>.</p>
+
+<p>Let’s add a new <code>&lt;h1&gt;</code> inside <code>&lt;div id="app"&gt;</code>. Since we’re going to be creating a todo list app below, let's set our header text to "To-Do List". Add it like so:</p>
+
+<pre class="brush: html notranslate">&lt;template&gt;
+ &lt;div id="app"&gt;
+ &lt;h1&gt;To-Do List&lt;/h1&gt;
+ &lt;/div&gt;
+&lt;/template&gt;</pre>
+
+<p><code>App.vue</code> will now show our heading, as you'd expect.</p>
+
+<h2 id="概要">概要</h2>
+
+<p>Let's leave this here for now. We've learnt about some of the ideas behind Vue, created some scaffolding for our example app to live inside, inspected it, and made a few preliminary changes.</p>
+
+<p>With a basic introduction out of the way, we'll now go further and build up our sample app, a basic Todo list application that allows us to store a list of items, check them off when done, and filter the list by all, complete, and incomplete todos.</p>
+
+<p>In the next article we'll build our first custom component, and look at some important concepts such as passing props into it and saving its data state.</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_resources","Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component", "Learn/Tools_and_testing/Client-side_JavaScript_frameworks")}}</p>
+
+<h2 id="このモジュールでは">このモジュールでは</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Introduction">Introduction to client-side frameworks</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Main_features">Framework main features</a></li>
+ <li>React
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_getting_started">Getting started with React</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_todo_list_beginning">Beginning our React todo list</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_components">Componentizing our React app</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_events_state">React interactivity: Events and state</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_interactivity_filtering_conditional_rendering">React interactivity: Editing, filtering, conditional rendering</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_accessibility">Accessibility in React</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/React_resources">React resources</a></li>
+ </ul>
+ </li>
+ <li>Ember
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_getting_started">Getting started with Ember</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_structure_componentization">Ember app structure and componentization</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_interactivity_events_state">Ember interactivity: Events, classes and state</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_conditional_footer">Ember Interactivity: Footer functionality, conditional rendering</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_routing">Routing in Ember</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Ember_resources">Ember resources and troubleshooting</a></li>
+ </ul>
+ </li>
+ <li>Vue
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_getting_started">Getting started with Vue</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component">Creating our first Vue component</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_rendering_lists">Rendering a list of Vue components</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_methods_events_models">Adding a new todo form: Vue events, methods, and models</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_styling">Styling Vue components with CSS</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_computed_properties">Using Vue computed properties</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_conditional_rendering">Vue conditional rendering: editing existing todos</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_refs_focus_management">Focus management with Vue refs</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_resources">Vue resources</a></li>
+ </ul>
+ </li>
+ <li>Svelte
+ <ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_getting_started">Getting started with Svelte</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_Todo_list_beginning">Starting our Svelte Todo list app</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_variables_props">Dynamic behavior in Svelte: working with variables and props</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_components">Componentizing our Svelte app</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_reactivity_lifecycle_accessibility">Advanced Svelte: Reactivity, lifecycle, accessibility</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_stores">Working with Svelte stores</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_TypeScript">TypeScript support in Svelte</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_deployment_next">Deployment and next steps</a></li>
+ </ul>
+ </li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/accessibility/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/accessibility/index.html
new file mode 100644
index 0000000000..26f98c400f
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/accessibility/index.html
@@ -0,0 +1,624 @@
+---
+title: よくあるアクセシビリティの問題を扱う
+slug: Learn/Tools_and_testing/Cross_browser_testing/Accessibility
+tags:
+ - Accessibility
+ - Article
+ - Beginner
+ - CSS
+ - CodingScripting
+ - HTML
+ - JavaScript
+ - Learn
+ - Testing
+ - Tools
+ - cross browser
+ - keyboard
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/Accessibility
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/JavaScript","Learn/Tools_and_testing/Cross_browser_testing/Feature_detection", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">次に、私たちはアクセシビリティに注意を向け、一般的な問題、簡単なテストの方法、そしてアクセシビリティの問題を見つけるための監査/自動化ツールの使い方を説明します。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td>コア <a href="/ja/docs/Learn/HTML">HTML</a>、<a href="/ja/docs/Learn/CSS">CSS</a>、および <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語に精通していること。 高水準の<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">クロスブラウザーテストの原則</a>の理解。</td>
+ </tr>
+ <tr>
+ <th scope="row">目的:</th>
+ <td>一般的なアクセシビリティの問題を診断し、それらを修正するための適切なツールとテクニックを使用できるようにすること。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="What_is_accessibility" name="What_is_accessibility">アクセシビリティとは?</h2>
+
+<p>ウェブ技術のコンテキストでアクセシビリティと言うとき、ほとんどの人は即座にウェブサイトやアプリが障碍のある人にも使えるようにすることを考えます。 例えば、</p>
+
+<ul>
+ <li>視覚障碍者は、スクリーンリーダーや拡大/ズームを使用してテキストにアクセスします。</li>
+ <li>運動機能障碍を持つ人々は、キーボード(または他のマウス以外の機能)を使用してウェブサイトの機能をアクティブ化します。</li>
+ <li>聴覚障碍を持つ人々は、音声や動画のコンテンツのキャプション/字幕またはその他の代替テキストに依存しています。</li>
+</ul>
+
+<p>しかし、アクセシビリティが単に障碍に関するものであると言うのは間違っています。 実際、アクセシビリティの目的は、高性能デスクトップコンピュータを使用しているユーザーだけでなく、できるだけ多くのコンテキストで、できるだけ多くのユーザーがウェブサイトやアプリを使用できるようにすることです。 極端な例には次のものが含まれます。</p>
+
+<ul>
+ <li>モバイルデバイスのユーザー。</li>
+ <li>テレビ、腕時計などの代替ブラウジングデバイスのユーザー。</li>
+ <li>最新のブラウザーを搭載していない可能性がある古いデバイスのユーザー。</li>
+ <li>低速プロセッサを搭載している可能性がある、低スペックデバイスのユーザー。</li>
+</ul>
+
+<p>ある意味では、このモジュール全体がアクセシビリティについてのものです — クロスブラウザーテストは、あなたのサイトができるだけ多くの人々によって使用できることを確認します。<a href="/ja/docs/Learn/Accessibility/What_is_accessibility"> アクセシビリティとは?</a>では、この記事よりも完全かつ徹底的にアクセシビリティを定義します。</p>
+
+<p>とは言っても、この記事では、クロスブラウザーと障碍のある人々を取り巻く問題のテスト、そして彼らのウェブの使い方について説明します。 モジュール内の他の場所で、<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Responsive_design_problems">レスポンシブデザイン</a>と<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript#Performance_issues">パフォーマンス</a>のような他の分野についてはすでに説明しました。</p>
+
+<div class="note">
+<p><strong>注</strong>: ウェブ開発における多くのことと同様に、アクセシビリティは 100% 成功したかどうかではありません。 特にサイトが複雑になるにつれて、100% のアクセシビリティを全てのコンテンツに対して達成することはほとんど不可能です。 その代わりに、防御的なコーディングを介して、できるだけ多くの人があなたのコンテンツのできるだけ多くにアクセスできるようにし、ベストプラクティスに従うようにする努力をします。</p>
+</div>
+
+<h2 id="Common_accessibility_issues" name="Common_accessibility_issues">よくあるアクセシビリティの問題</h2>
+
+<p>このセクションでは、従うべきベストプラクティスと共に、特定の技術と結びつけて、ウェブのアクセシビリティに関して生じる主な問題のいくつかと、サイトが正しい方向に進んでいるかどうかを確認するための簡単なテストについて、詳細を説明します。</p>
+
+<div class="note">
+<p><strong>注</strong>: アクセシビリティは道徳的に正しいことであり、ビジネスには適していますし(多くの障碍のあるユーザー、モバイルデバイスのユーザーなどが重要な市場セグメントを提示しています)、ウェブ資産を障碍のある人々がアクセスできないようにすることは、世界の多くの地域で法律にも違反しています。 詳しくは<a href="/ja/docs/Learn/Accessibility/What_is_accessibility#Accessibility_guidelines_and_the_law">アクセシビリティのガイドラインと法律</a>を読んでください。</p>
+</div>
+
+<h3 id="HTML" name="HTML">HTML</h3>
+
+<p>意味論的 HTML(要素が正しい目的のために使用されているもの)は箱から出してすぐにアクセスできます — そのようなコンテンツは晴眼者でも読めますし(CSS を使用して、テキストを小さくしすぎたり、隠したりするような愚かなことはしないでください)、スクリーンリーダー(文字通りウェブページをユーザーに読み上げるアプリ)などの支援技術でも使用可能になり、他の利点も付与されます。</p>
+
+<h4 id="Semantic_structure" name="Semantic_structure">意味論的構造</h4>
+
+<p>意味論的 HTML で最も重要なすばやい勝利は、コンテンツに見出しと段落の構造を使用することです。 これは、スクリーンリーダーのユーザーが、必要なコンテンツをすばやく見つけるために文書の見出しを道標として使用する傾向があるためです。 あなたのコンテンツが見出しを持っていない場合、彼らが得るのは、何かを見つけるための道標のないテキストの巨大な壁だけです。 悪い HTML と良いHTML の例としては、</p>
+
+<pre class="brush: html example-bad">&lt;font size="7"&gt;私の見出し&lt;/font&gt;
+&lt;br&gt;&lt;br&gt;
+これが私の文書の最初のセクションです。
+&lt;br&gt;&lt;br&gt;
+ここにも段落を追加します。
+&lt;br&gt;&lt;br&gt;
+&lt;font size="5"&gt;私の副見出し&lt;/font&gt;
+&lt;br&gt;&lt;br&gt;
+これが私の文書の最初のサブセクションです。 私は人々がこのコンテンツを見つけることができるようにしたいです!
+&lt;br&gt;&lt;br&gt;
+&lt;font size="5"&gt;私の2番目の副見出し&lt;/font&gt;
+&lt;br&gt;&lt;br&gt;
+これは私のコンテンツの2番目のサブセクションです。 私は最後のものよりも面白いと思います。</pre>
+
+<pre class="brush: html example-good">&lt;h1&gt;私の見出し&lt;/h1&gt;
+
+&lt;p&gt;これが私の文書の最初のセクションです。&lt;/p&gt;
+
+&lt;p&gt;ここにも段落を追加します。&lt;/p&gt;
+
+&lt;h2&gt;私の副見出し&lt;/h2&gt;
+
+&lt;p&gt;これが私の文書の最初のサブセクションです。 私は人々がこのコンテンツを見つけることができるようにしたいです!&lt;/p&gt;
+
+&lt;h2&gt;私の2番目の副見出し&lt;/h2&gt;
+
+&lt;p&gt;これは私のコンテンツの2番目のサブセクションです。 私は最後のものよりも面白いと思います。&lt;/p&gt;</pre>
+
+<p>さらに、あなたのコンテンツはそのソース順で論理的に意味があるべきです — あなたは後で CSS を使い、いつでもそれを望んだ所に置くことができますが、最初から正しいソース順を手にするべきです。</p>
+
+<p>テストとして、あなたはサイトの CSS をオフにして、CSS がなければそれがどれほど理解できるか見ることができます。 コードから CSS を取り除くだけでこれを手動で行うことができますが、最も簡単な方法はブラウザー機能を使用することです。 例えば、</p>
+
+<ul>
+ <li>Firefox: メニューバーから [表示] &gt; [スタイルシート] &gt; [スタイルシートを使用しない] を選択します。</li>
+ <li>Safari: メインメニューから [開発] &gt; [スタイルを無効にする] を選択します([開発] メニューを有効にするには、[Safari] &gt; [環境設定] &gt; [詳細] &gt; [メニューバーに開発メニューを表示] を選択)。</li>
+ <li>Chrome: Web Developer Toolbar 拡張機能をインストールしてから、ブラウザーを再起動します。 表示される歯車のアイコンをクリックしてから、[CSS] &gt; [全てのスタイルを無効にする] を選択します。</li>
+ <li>Edge: メインメニューから [表示] &gt; [スタイル] &gt; [スタイルなし] を選択します。</li>
+</ul>
+
+<h4 id="Using_native_keyboard_accessibility" name="Using_native_keyboard_accessibility">ネイティブなキーボード・アクセシビリティを使う</h4>
+
+<p>特定の HTML 機能はキーボードのみを使用して選択できます — これはデフォルトの動作で、ウェブの初期の頃から使用可能です。 この機能を持つ要素は、ユーザーがウェブページと対話することを可能にする一般的なもの、すなわちリンク、{{htmlelement("button")}}、そして {{htmlelement("input")}} のようなフォーム要素です。</p>
+
+<p><a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/accessibility/native-keyboard-accessibility.html">native-keyboard-accessibility.html</a> の例を使ってこれを試すことができます(<a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/accessibility/native-keyboard-accessibility.html">ソースコード</a>を見る) — これを新しいタブで開いて、そして <kbd>Tab</kbd> キーを押してみてください。 数回押すと、タブフォーカスがさまざまなフォーカス可能な要素を通過し始めます。 どの要素がフォーカスされているかわかるように、フォーカスされた要素には全てのブラウザーでハイライトされたデフォルトのスタイルが与えられます(ブラウザーによって若干異なります)。</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14215/button-focused-unfocused.png" style="border-style: solid; border-width: 1px; display: block; height: 39px; margin: 0px auto; width: 288px;"></p>
+
+<p>次に <kbd>Enter</kbd> / <kbd>Return</kbd> を押してフォーカスのあるリンクをたどるか、ボタンを押すか(ボタンにメッセージを知らせるための JavaScript が含まれています)、テキスト入力にテキストを入力するためにタイプし始めることができます(他のフォーム要素には異なるコントロールがあります。 例えば、{{htmlelement("select")}} 要素では、<kbd>上下の矢印</kbd>キーを使用してそのオプションを表示したり切り替えたりできます)。</p>
+
+<p>ブラウザーが異なれば、使用可能なキーボードコントロールオプションも異なることに注意してください。 最近のほとんどのブラウザーは上記のタブパターンに従いますが(フォーカス可能な要素を逆方向に移動するために <kbd>Shift</kbd> + <kbd>Tab</kbd> を押すこともできます)、次のようにブラウザーによっては独自の特徴があります。</p>
+
+<ul>
+ <li>Mac 用の Firefox はデフォルトではタブ移動を行いません。 オンにするには、 [環境設定] &gt; [詳細] &gt; [一般] の順に選択してから、[常にページ内を移動するにはカーソルキーを使用する] のチェックを外します。 次に、Mac のシステム環境設定アプリを開き、[キーボード] &gt; [ショートカット] の順に選択して、[全てのコントロール] ラジオボタンを選択します。</li>
+ <li>Safari では、デフォルトではリンクをタブ操作することはできません。 これを有効にするには、Safari の [環境設定] を開き、[詳細] に移動し、[Tab キーを押してウェブページの各項目をハイライトする] チェックボックスをオンにする必要があります。</li>
+</ul>
+
+<div class="warning">
+<p><strong>重要</strong>: あなたが書く新しいページのどれでも、この種のテストを実行するべきです — 機能がキーボードによってアクセスできることを確認してください。</p>
+</div>
+
+<p>この例では、正しい仕事に正しい意味論的要素を使用することの重要性を強調しています。 任意の要素を、CSS でリンクやボタンのように見せたり、JavaScript でリンクやボタンのように振る舞うようにスタイルすることは可能ですが、実際にはリンクやボタンにはならず、あなたはこれらの要素が無料で与えるアクセシビリティの多くを失うでしょう。 あなたがそれを避けることができるならばしないでください。</p>
+
+<p>もう1つのヒント — 次の例に示すように、{{cssxref(":focus")}} 疑似クラスを使用して、フォーカス可能要素のフォーカス時の外観をコントロールできます。 フォーカスとホバーのスタイルを倍増するのは良い考えです。 それにより、マウスやキーボードを使用しているかどうかに関わらず、ユーザーがコントロールをアクティブにしたときに何かが行われるという視覚的な手がかりを得ることができます。</p>
+
+<pre class="brush: css">a:hover, input:hover, button:hover, select:hover,
+a:focus, input:focus, button:focus, select:focus {
+ font-weight: bold;
+}</pre>
+
+<div class="note">
+<p><strong>注</strong>: CSS を使用してデフォルトのフォーカススタイルを取り除く場合は、デザインに適した他のスタイルに置き換えてください — これは非常に有用なアクセシビリティツールであり、取り除くべきではありません。</p>
+</div>
+
+<h4 id="Building_in_keyboard_accessibility" name="Building_in_keyboard_accessibility">キーボード・アクセシビリティを組み込む</h4>
+
+<p>時にはキーボード・アクセシビリティを失うことが避けられないこともあります。 意味論的にあまり良くないサイトを継承したかもしれませんし(<code>&lt;div&gt;</code> で作られたボタンを生成する恐ろしい {{glossary("CMS")}} に行き着くかもしれません)、HTML5 の {{htmlelement("video")}} 要素のようにキーボード・アクセシビリティが組み込まれていない複雑なコントロールを使用しているかもしれません(驚くべきことに、Opera は <code>&lt;video&gt;</code> 要素のデフォルトのブラウザーコントロールをタブ操作できる唯一のブラウザーです)。 次のようないくつかの選択肢があります。</p>
+
+<ol>
+ <li><code>&lt;button&gt;</code> 要素(デフォルトでタブ移動可能)と JavaScript を使用してカスタムコントロールを作成し、それらの機能を関連付けます。 これについての良い例は、<a href="/ja/docs/Web/Apps/Fundamentals/Audio_and_video_delivery/cross_browser_video_player">クロスブラウザーのビデオプレーヤーの作成</a>を参照してください。</li>
+ <li>JavaScript でキーボードショートカットを作成すると、キーボードの特定のキーを押すことで機能をアクティブにできます。 あらゆる目的に適応できるゲーム関連の例については、<a href="/ja/docs/Games/Techniques/Control_mechanisms/Desktop_with_mouse_and_keyboard">デスクトップのマウスとキーボードのコントロール</a>を参照してください。</li>
+ <li>偽のボタンの振る舞いのために、いくつかの興味深い戦術を使ってください。 例えば、<a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/accessibility/fake-div-buttons.html">fake-div-buttons.html</a> の例を見てください(<a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/accessibility/fake-div-buttons.html">ソースコード</a>を見る)。 ここでは、それぞれの属性に <code>tabindex="0"</code> という属性を与えることで(もっと有用な詳細については WebAIM の <a href="http://webaim.org/techniques/keyboard/tabindex">tabindex の記事</a>(英語)を見てください)、偽の <code>&lt;div&gt;</code> ボタンにフォーカスできるようにしました(タブを介すことも含む)。 これにより、ボタンにタブ移動することはできますが、<kbd>Enter</kbd> / <kbd>Return</kbd> キーでそれらをアクティブにすることはできません。 そのためには、次のちょっとした JavaScript トリックを追加する必要があります。
+ <pre class="brush: js">document.onkeydown = function(e) {
+ if(e.keyCode === 13) { // The Enter/Return key
+ document.activeElement.onclick(e);
+ }
+};</pre>
+ ここでは、<code>document</code> オブジェクトにリスナーを追加して、キーボードのボタンが押されたことを検出します。 イベントオブジェクトの <code><a href="/ja/docs/Web/API/KeyboardEvent/keyCode">keyCode</a></code> プロパティを使ってどのボタンが押されたかをチェックし、<kbd>Return</kbd> / <kbd>Enter</kbd> と一致するキーコードであれば、<code>document.activeElement.onclick()</code> を使用してボタンの <code>onclick</code> ハンドラに格納されている関数を実行します。 <code><a href="/ja/docs/Web/API/Document/activeElement">activeElement</a></code> は現在ページにフォーカスしている要素を与えます。</li>
+</ol>
+
+<div class="note">
+<p><strong>注</strong>: この手法は、イベントハンドラ・プロパティ(<code>onclick</code> など)を使ってオリジナルのイベントハンドラを設定した場合にのみ機能します。 <code>addEventListener</code> は機能しません。 これは、機能を再構築するための非常に面倒な作業です。 それに他にも問題があるはずです。 そもそも正しい要素を正しい仕事に使うほうがよいでしょう。</p>
+</div>
+
+<h4 id="Text_alternatives" name="Text_alternatives">代替テキスト</h4>
+
+<p>代替テキストは、アクセシビリティにとって非常に重要です — ある人が視覚障碍または聴覚障碍を抱えているためにコンテンツを見たり聞いたりすることができなくなると、これが問題になります。 最も単純な代替テキストは、控え目な {{htmlattrxref("alt","img")}} 属性で、関連するコンテンツを含む全ての画像に含めるべきです。 これはスクリーンリーダーが拾ってユーザーに読み上げるために、ページ上にその意味と内容をうまく伝える画像の説明を含むべきです。</p>
+
+<div class="note">
+<p><strong>注</strong>: 詳しくは、<a href="/ja/docs/Learn/Accessibility/HTML#Text_alternatives">代替テキスト</a>をお読みください。</p>
+</div>
+
+<p>欠落している代替テキストは、アクセシビリティ{{anch("Auditing tools","監査ツール")}}を使用するなど、さまざまな方法でテストできます。</p>
+
+<p>代替テキストは、動画と音声のコンテンツにとってはもう少し複雑です。 テキストトラック(字幕など)を定義し、動画の再生時にそれらを {{htmlelement("track")}} 要素と <a href="/ja/docs/Web/API/Web_Video_Text_Tracks_Format">WebVTT</a> 形式の形式で表示する方法があります(詳細なチュートリアルについては、<a href="/ja/docs/Web/Apps/Build/Manipulating_media/Adding_captions_and_subtitles_to_HTML5_video">HTML5 の動画へのキャプションと字幕の追加</a>を参照してください)。 これらの機能に対する<a href="/ja/Apps/Fundamentals/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video#Browser_Compatibility">ブラウザーの互換性</a>はかなり良いのですが、音声用の代替テキストを提供したり、古いブラウザーをサポートしたりする場合は、ページのどこかや別のページに提示した単純なテキストトランスクリプトをお勧めします。</p>
+
+<h4 id="Element_relationships_and_context" name="Element_relationships_and_context">要素の関係とコンテキスト</h4>
+
+<p>HTML には、他に存在しない要素間のコンテキストと関係を提供するように設計された特定の機能とベストプラクティスがあります。 最も一般的な3つの例は、リンク、フォームラベル、およびデータ表です。</p>
+
+<p>アクセス可能なリンクテキストの鍵は、スクリーンリーダーを使用している人々が、ページ上の全てのリンクのリストを引き出すという共通の機能を使用することが多いということです。 この場合、リンクテキストはコンテキスト外で意味を成す必要があります。 例えば、「ここをクリック」、「ここをクリック」などのラベルが付いたリンクのリストは、アクセシビリティにとって本当に悪いものです。 リンクテキストはコンテキスト内でもコンテキスト外でも意味を成すのが得策です。</p>
+
+<p>次に、フォームの {{htmlelement("label")}} 要素は、フォームをアクセス可能にすることを可能にする中心的な機能の1つです。 フォームの悩みは、各フォーム入力にどのデータを入力するべきかを示すためにラベルが必要なことです。 各ラベルを {{htmlelement("label")}} 内に含めて相方のフォーム入力に明確にリンクする必要があり(各 <code>&lt;label&gt;</code> の <code>for</code> 属性値はフォーム要素の <code>id</code> 値と一致する必要があります)、ソース順が完全に論理的ではなくても(これは公平であるべきです)、それは意味があります。</p>
+
+<div class="note">
+<p><strong>注</strong>:リンクテキストとフォームラベルの詳細については、<a href="/ja/docs/Learn/Accessibility/HTML#Meaningful_text_labels">わかりやすいテキストラベル</a>を参照してください。</p>
+</div>
+
+<p>最後に、データ表について簡単に説明します。 基本的なデータ表は非常に簡単なマークアップで書くことができますが(bad-table.html の<a href="http://mdn.github.io/learning-area/accessibility/html/bad-table.html">ライブ</a>と<a href="https://github.com/mdn/learning-area/blob/master/accessibility/html/bad-table.html">ソース</a>を見る)、問題があります — スクリーンリーダーのユーザーがデータのグループとして行や列を関連付ける方法はありません — これを行うには、ヘッダー行がどれであるか、そしてそれらが行、列などを見出ししているかどうかを知る必要があります。 これはそのような表に対しては視覚的にしかできません。</p>
+
+<p>代わりに punk-bands-complete.html の例(<a href="https://mdn.github.io/learning-area/css/styling-boxes/styling-tables/punk-bands-complete.html">ライブ</a>、<a href="https://github.com/mdn/learning-area/blob/master/css/styling-boxes/styling-tables/punk-bands-complete.html">ソース</a>)を見ると、表のヘッダー({{htmlelement("th")}} と <code>scope</code> 属性)、{{htmlelement("caption")}} 要素など、いくつかのアクセシビリティ補助機能が働いていることがわかります。</p>
+
+<div class="note">
+<p><strong>注</strong>: アクセス可能な表の詳細については、<a href="/ja/docs/Learn/Accessibility/HTML#Accessible_data_tables">アクセス可能なデータ表</a>を参照してください。</p>
+</div>
+
+<h3 id="CSS" name="CSS">CSS</h3>
+
+<p>CSS は HTML よりもはるかに少ない基本的なアクセシビリティ機能を提供する傾向がありますが、それでも誤って使用された場合、それはアクセシビリティにちょうど同じくらい多くの損害を与えることができます。 CSS に関するアクセシビリティのヒントをいくつかすでに説明しました。</p>
+
+<ul>
+ <li>HTML においてさまざまなコンテンツをマークアップするには、正しい意味論的要素を使用してください。 別の視覚効果を作成したい場合は、CSS を使用します — 必要な外観を得るために HTML 要素を悪用しないでください。 例えば、もっと大きなテキストが必要な場合は、{{htmlelement("h1")}} 要素ではなく {{cssxref("font-size")}} を使用してください。</li>
+ <li>ソース順が CSS なしで意味を成すことを確認してください。 常に CSS を使用することで後で好きなようにページをスタイルできます。</li>
+ <li>ユーザーに機能に関する視覚的な手がかりを与えるため、ボタンやリンクのようなインタラクティブな要素に適切なフォーカス/ホバー/アクティブ状態が設定されていることを確認するべきです。 スタイル上の理由でデフォルトを取り除いた場合は、代替スタイルが含まれていることを確認してください。</li>
+</ul>
+
+<p>考慮すべき点が他にもいくつかあります。</p>
+
+<h4 id="Color_and_color_contrast" name="Color_and_color_contrast">色とカラーコントラスト</h4>
+
+<p>ウェブサイトの配色を選択するときは、テキスト(前景)のカラーコントラストが背景色とよく合うことを確認するべきです。 あなたのデザインはかっこいいかもしれませんが、色覚異常のような視覚障碍を持つ人々がコンテンツを読むことができないならば、それは良くありません。 配色に十分なコントラストがあるかどうかチェックするために WebAIM の<a href="http://webaim.org/resources/contrastchecker/">カラーコントラストチェッカー</a>(英語)のようなツールを使ってください。</p>
+
+<p>もう1つのヒントは、道標や情報を色だけに頼らないようにすることです。 これは、色が見えない人には良くないでしょう。 例えば、必須のフォームフィールドを赤でマークする代わりに、赤いアスタリスクでマークします。</p>
+
+<div class="note">
+<p><strong>注</strong>: コントラスト比が高いと、光沢のある画面を備えたスマートフォンやタブレットを使用している人は誰でも、日光のような明るい環境にいるときにページを読みやすくなります。</p>
+</div>
+
+<h4 id="Hiding_content" name="Hiding_content">コンテンツを隠す</h4>
+
+<p>ビジュアルデザインでは、全てのコンテンツを一度に表示する必要がない多くの実例があります。 例えば、<a href="http://mdn.github.io/learning-area/css/css-layout/practical-positioning-examples/info-box.html">タブ付き情報ボックスの例</a>(<a href="https://github.com/mdn/learning-area/blob/master/css/css-layout/practical-positioning-examples/info-box.html">ソースコード</a>を見る)には3つの情報パネルがありますが、それらを重ねて<a href="/ja/docs/Learn/CSS/CSS_layout/Positioning">配置</a>し、それぞれを表示するためにクリックできるタブを提供しています(キーボードからもアクセス可能です — 代わりに <kbd>Tab</kbd> と <kbd>Enter</kbd> / <kbd>Return</kbd> を使って選択することもできます)。</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/16918/20191022144107.png" style="display: block; height: 1131px; margin: 0px auto; max-width: 450px; width: 1272px;"></p>
+
+<p>スクリーンリーダーのユーザーは、このことを気にしません — コンテンツのソース順が意味を成す限り幸せで、全てに到達できます。 絶対配置(この例で使用されているような)は一般に視覚効果のためにコンテンツを隠す最も良いメカニズムの1つとして見られます、なぜならそれはスクリーンリーダーがそれに到達するのを止めないからです。</p>
+
+<p>一方で、スクリーンリーダーからコンテンツを隠すので、{{cssxref("visibility")}}<code>:hidden</code> や {{cssxref("display")}}<code>:none</code> は使用しないでください。 正当な理由があるのでなければ、なぜこのコンテンツをスクリーンリーダーから隠したいのでしょうか。</p>
+
+<div class="note">
+<p><strong>注</strong>: <a href="http://webaim.org/techniques/css/invisiblecontent/">スクリーンリーダーのユーザーには見えないコンテンツ</a>(英語)には、このトピックに関するもっと有用な詳細があります。</p>
+</div>
+
+<h3 id="JavaScript" name="JavaScript">JavaScript</h3>
+
+<p>JavaScript はアクセシビリティに関して CSS と同じ種類の問題を抱えています — それが悪用されたり、乱用されたりするとアクセシビリティの災害になる可能性があります。 JavaScript に関連するアクセシビリティの問題、主に意味論的 HTML の分野についてはすでに示唆しています — 例えば、リンクやボタンを適切に使用するなど、適切な意味論的 HTML を使用して機能を実装するべきです。 可能であれば、JavaScript コードで <code>&lt;div&gt;</code> 要素を使用して機能を偽造しないでください — エラーが発生しやすく、HTML の無料機能を使用するよりも手間がかかります。</p>
+
+<h4 id="Simple_functionality" name="Simple_functionality">単純な機能</h4>
+
+<p>一般的に単純な機能は HTML だけで適切に機能するはずです — JavaScript は機能を強化するためにのみ使用されるべきであり、完全には組み込みません。 JavaScript の良い使い方には次のものが含まれます。</p>
+
+<ul>
+ <li>クライアント側のフォーム検証を提供します。 これは、サーバーがデータをチェックするのを待たずに、フォームエントリに関する問題をユーザーにすばやく知らせるものです。 利用できない場合でもフォームは機能しますが、検証が遅くなる可能性があります。</li>
+ <li>キーボードのみのユーザーがアクセスできる HTML5 の <code>&lt;video&gt;</code> のカスタムコントロールを提供します(前述したように、デフォルトのブラウザーコントロールはほとんどのブラウザーでキーボードからアクセスできません)。</li>
+</ul>
+
+<div class="note">
+<p><strong>注</strong>: WebAIM の<a href="http://webaim.org/techniques/javascript/">アクセス可能な JavaScript</a>(英語)は、アクセス可能な JavaScript の考慮事項に関する有用な詳細をいくつか提供します。</p>
+</div>
+
+<p>より複雑な JavaScript による実装はアクセシビリティに問題をもたらす可能性があります — できる限りのことをする必要があります。 例えば、<a href="/ja/docs/Web/API/WebGL_API/Tutorial">WebGL</a> を 100% を使用して書かれた複雑な 3D ゲームを視覚障碍者が利用できるようにすることは期待できませんが、マウス以外のユーザーが使用できるように<a href="/ja/docs/Games/Techniques/Control_mechanisms/Desktop_with_mouse_and_keyboard">キーボードコントロール</a>を実装し、色覚異常のある人にも使えるように配色に十分なコントラストがあるようにすることができます。</p>
+
+<h4 id="Complex_functionality" name="Complex_functionality">複雑な機能</h4>
+
+<p>アクセシビリティにとって問題となる主な分野の1つは、(日付の選択のような)複雑なフォームコントロールを含む複雑なアプリと、頻繁に増分的に更新される動的コンテンツです。</p>
+
+<p>ネイティブではない複雑なフォームコントロールは、ネストされた <code>&lt;div&gt;</code> が多数含まれる傾向があり、ブラウザーがデフォルトでそれらをどう処理するかわからないため、問題があります。 自分でそれらを考案しているのなら、それらがキーボードからアクセスできることを確認する必要があります。 何らかのサードパーティ製フレームワークを使用している場合は、利用可能なオプションを慎重に検討して、飛びつく前にそれらがどれほどアクセス可能かを確認してください。 <a href="http://getbootstrap.com/">Bootstrap</a> は、アクセシビリティにはかなり適しているように見えます。 例えば、Rhiana Heath による <a href="https://www.sitepoint.com/making-bootstrap-accessible/">Bootstrap をもう少しアクセス可能にする</a>(英語)では、その問題のいくつかを調べ(主にカラーコントラストに関連した)、いくつかの解決策を検討しています。</p>
+
+<p>定期的に更新される動的コンテンツは、スクリーンリーダーのユーザーがそれを見逃す可能性があるため、特に突然更新される場合は問題になる可能性があります。 <a href="/ja/docs/Web/API/XMLHttpRequest">XMLHttpRequest</a> または <a href="/ja/docs/Web/API/Fetch_API">Fetch</a> を使用して定期的に更新されるメインコンテンツパネルを備えた単一ページのアプリがある場合、スクリーンリーダーのユーザーはそれらの更新を見逃す可能性があります。</p>
+
+<h4 id="WAI-ARIA" name="WAI-ARIA">WAI-ARIA</h4>
+
+<p>そのような複雑な機能を使用する必要がありますか、それともごく普通の意味論的 HTML が代わりにやりますか? 複雑なものが必要な場合は、<a href="https://www.w3.org/TR/wai-aria-1.1/">WAI-ARIA</a>(Accessible Rich Internet Applications)を使用することを検討するべきです。 これは、ほとんどのブラウザーやスクリーンリーダーが理解できる複雑なフォームコントロールや更新パネルのような項目に(新しい HTML 属性の形式で)意味論を提供する仕様です。</p>
+
+<p>複雑なフォームウィジェットを扱うには、さまざまな要素がウィジェット内でどのような役割を担っているか(例えば、タブなのか、タブパネルなのか)を示す <code>role</code>、コントロールが無効かどうかを示す <code>aria-disabled</code> などの ARIA 属性を使う必要があります。</p>
+
+<p>定期的に更新されるコンテンツのリージョンを扱うには、更新されるリージョンを識別する <code>aria-live</code> 属性を使用できます。 その値は、次のようにスクリーンリーダーがどれほど緊急にそれを読み上げるべきかを示します。</p>
+
+<ul>
+ <li><code>off</code>: デフォルト。 更新はアナウンスされるべきではありません。</li>
+ <li><code>polite</code>: 更新はユーザーがアイドル状態の場合にのみアナウンスされるべきです。</li>
+ <li><code>assertive</code>: 更新はできるだけ早くユーザーにアナウンスされるべきです。</li>
+ <li><code>rude</code>: ユーザーに割り込んだとしても、更新はすぐにアナウンスされるべきです。</li>
+</ul>
+
+<p>これが一例です。</p>
+
+<pre class="brush: html">&lt;p&gt;&lt;span id="LiveRegion1" aria-live="polite" aria-atomic="false"&gt;&lt;/span&gt;&lt;/p&gt;</pre>
+
+<p>Freedom Scientific の <a href="http://www.freedomscientific.com/Training/Surfs-up/AriaLiveRegions.htm">ARIA(Accessible Rich Internet Applications)のライブリージョン</a>(英語)の例で実行中の例を見ることができます — 強調表示された段落はその内容を10秒ごとに更新し、スクリーンリーダーはユーザーにこれを読み上げるべきです。<a href="http://www.freedomscientific.com/Training/Surfs-up/AriaLiveRegionsAtomic.htm"> ARIA のライブリージョン - Atomic</a>(英語)は別の有用な例を提​​供しています。</p>
+
+<p>ここでは WAI-ARIA を詳細にカバーするためのスペースはありません。 <a href="/ja/docs/Learn/Accessibility/WAI-ARIA_basics">WAI-ARIA の基本</a>でもっと詳しく学ぶことができます。</p>
+
+<h2 id="Accessibility_tools" name="Accessibility_tools">アクセシビリティツール</h2>
+
+<p>今まで(キーボードナビゲーションやカラーコントラストチェッカーのような)いくつかのテストのテクニックを含め、さまざまなウェブ技術に対するアクセシビリティの考慮事項について説明してきました。 次に、アクセシビリティのテストを実行するときに使用できる他のツールを見てみましょう。</p>
+
+<h3 id="Auditing_tools" name="Auditing_tools">監査ツール</h3>
+
+<p>あなたのウェブページを指さすことができる利用可能な監査ツールがいくつかあります。 それらはページを見て、ページに存在するアクセシビリティ問題のリストを返すでしょう。 例えば次のものが含まれます。</p>
+
+<ul>
+ <li><a href="https://tenon.io">Tenon</a>: 提供された URL でコードを調べて、メトリクス、WCAG 基準が影響を及ぼす WCAG 基準に沿った特定のエラー、および修正案を含むアクセシビリティエラーに関する結果を返す、かなりいいオンラインアプリです。</li>
+ <li><a href="http://khan.github.io/tota11y/">tota11y</a>: Khan Academy のアクセシビリティツールで、JavaScript ライブラリの形式を取り、ページに添付するいくつかのアクセシビリティツールを提供します。</li>
+ <li><a href="http://wave.webaim.org/">Wave</a>: ウェブアドレスを受け入れて、そのページの有用な注釈付きビューを強調表示したアクセシビリティの問題とともに返すオンラインのアクセシビリティテストツールです。</li>
+</ul>
+
+<p>Tenon を使って例を見てみましょう。</p>
+
+<ol>
+ <li><a href="https://tenon.io">Tenon のホームページ</a>(英語)に行きます。</li>
+ <li><a href="http://mdn.github.io/learning-area/accessibility/html/bad-semantics.html">bad-semantics.html</a> の例の URL(または分析したい別のウェブページの URL)をページ上部のテキスト入力に入力して [Analyze Your Webpage] を押します。</li>
+ <li>次に示すように、error/description のセクションが見つかるまで下にスクロールします。</li>
+</ol>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14217/tenon-screenshot.png" style="border-style: solid; border-width: 1px; display: block; height: 593px; margin: 0px auto; width: 870px;"></p>
+
+<p>また、Tenon をプログラム的に使用するための API と同様に、探索できるいくつかのオプション(ページ上部の近くにある [Show Options] リンクを参照)もあります。</p>
+
+<div class="note">
+<p><strong>注</strong>: このようなツールは、アクセシビリティの問題を全て自分で解決するのに十分ではありません。 全体像を把握するには、これらの組み合わせ、知識と経験、ユーザーテストなどが必要です。</p>
+</div>
+
+<h3 id="Automation_tools" name="Automation_tools">自動化ツール</h3>
+
+<p><a href="https://www.deque.com/products/axe/">Deque の aXe ツール</a>(英語)は、前述した監査ツールよりも少しばかり進化しています。 他のものと同様に、ページをチェックしてアクセシビリティエラーを返します。 その最もすぐに役立つ形式は、おそらく次のブラウザー拡張機能です。</p>
+
+<ul>
+ <li><a href="http://bitly.com/aXe-Chrome">Chrome 用の aXe</a>(英語)</li>
+ <li><a href="http://bit.ly/aXe-Firefox">Firefox 用の aXe</a>(英語)</li>
+</ul>
+
+<p>これらはブラウザー開発者ツールにアクセシビリティタブを追加します。 例えば、Firefox 用のバージョンをインストールし、それを使用して <a href="http://mdn.github.io/learning-area/accessibility/html/bad-table.html">bad-table.html</a> の例を監査すると、次の結果が得られます。</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14213/aXe-screenshot.png" style="display: block; height: 580px; margin: 0px auto; width: 800px;"></p>
+
+<p>aXe は <code>npm</code> を使ってもインストール可能で、<a href="http://gruntjs.com/">Grunt</a> や <a href="http://gulpjs.com/">Gulp</a> のようなタスクランナー、<a href="http://www.seleniumhq.org/">Selenium</a> や <a href="https://cucumber.io/">Cucumber</a> のような自動化フレームワーク、<a href="http://jasmine.github.io/">Jasmin</a> のような単体テストフレームワークなどと統合することができます(やはり、詳細については<a href="https://www.deque.com/products/axe/">メインの aXe ページ</a>(英語)を参照してください)。</p>
+
+<h3 id="Screenreaders" name="Screenreaders">スクリーンリーダー</h3>
+
+<p>重度の視覚障碍者がウェブをどのように使用しているかに慣れるには、スクリーンリーダーを使ってテストする価値があります。 次のように利用可能なスクリーンリーダーは多数あります。</p>
+
+<ul>
+ <li><a href="http://www.freedomscientific.com/Products/Blindness/JAWS">JAWS</a>(Windows)や <a href="http://www.gwmicro.com/window-eyes/">Window Eyes</a>(Windows、販売終了)のような有料製品もあります。</li>
+ <li><a href="http://www.nvaccess.org/">NVDA</a>(Windows)、<a href="http://www.chromevox.com/">ChromeVox</a>(Chrome、Windows、Mac OS X)、<a href="https://wiki.gnome.org/Projects/Orca">Orca</a>(Linux)などの無料製品もあります。</li>
+ <li><a href="http://www.apple.com/accessibility/osx/voiceover/">VoiceOver</a>(Mac OS X、iOS)、<a href="http://www.chromevox.com/">ChromeVox</a>(Chromebook 上)、および <a href="https://play.google.com/store/apps/details?id=com.google.android.marvin.talkback">TalkBack</a> (Android)など、一部はオペレーティングシステムに組み込まれています。</li>
+</ul>
+
+<p>一般的に、スクリーンリーダーはホストオペレーティングシステム上で動作する独立したアプリで、ウェブページだけでなく他のアプリのテキストも読むことができます。 これは必ずしもそうとは限りませんが(ChromeVox はブラウザーの拡張機能です)、通常はそうです。 スクリーンリーダーは少し異なる方法で動作し、異なるコントロールを持つ傾向があるので、全ての詳細を得るためにはあなたが選んだスクリーンリーダーのドキュメントを参照しなければなりません — と言っても、それらは全て基本的に同じような方法で機能します。</p>
+
+<p>いくつかの異なるスクリーンリーダーを使っていくつかのテストを行い、それらがどのように機能するのか、またどのようにテストするのかについての一般的な考えを説明しましょう。</p>
+
+<div class="note">
+<p><strong>注</strong>: WebAIM の<a href="http://webaim.org/techniques/screenreader/">スクリーンリーダーの互換性のための設計</a>(英語)では、スクリーンリーダーの使用方法とスクリーンリーダーに最適な機能についての役立つ情報が提供されています。 いくつかの興味深いスクリーンリーダーの使用統計については、<a href="http://webaim.org/projects/screenreadersurvey6/#used">第6回スクリーンリーダーのユーザー調査の結果</a>(英語)も参照してください。</p>
+</div>
+
+<h4 id="VoiceOver" name="VoiceOver">VoiceOver</h4>
+
+<p>VoiceOver(VO)は Mac / iPhone / iPad には無料で含まれているので、あなたが Apple 製品を使っているならそれはデスクトップ/モバイルでテストするのに役に立ちます。 ここでは、MacBook Pro の Mac OS X でテストします。</p>
+
+<p>オンにするには、<kbd>Cmd</kbd> + <kbd>Fn</kbd> + <kbd>F5</kbd> を押します。 今までに VO を使ったことがない場合は、ようこそ画面が表示され、そこで VO を起動するかどうかを選択できます。 また、使い方を学ぶためにかなり役に立つチュートリアルを実行することもできます。 再びオフにするには、もう一度 <kbd>Cmd</kbd> + <kbd>Fn</kbd> + <kbd>F5</kbd> を押します。</p>
+
+<div class="note">
+<p><strong>注</strong>: チュートリアルは少なくとも一度は実行するべきです — これは VO を学ぶ上で非常に便利な方法です。</p>
+</div>
+
+<p>VO がオンになっていると、ディスプレイはほぼ同じに見えますが、画面の左下に、現在選択されている VO に関する情報を含む黒いボックスが表示されます。 現在の選択範囲も黒枠で強調表示されます — この強調表示は <strong>VO カーソル</strong>と呼ばれます。</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14219/voiceover.png" style="border-style: solid; border-width: 1px; display: block; height: 386px; margin: 0px auto; width: 800px;"></p>
+
+<p>VO を使用するには、「VO 修飾キー」を多用します — これは、実際の VO キーボードショートカットに加えて、それらを機能させるために押す必要があるキーまたはキーの組み合わせです。 このような修飾キーを使用するのは、スクリーンリーダーに共通で、他のコマンドとコマンドが衝突しないようにするためです。 VO の場合、修飾キーは <kbd>CapsLock</kbd> または <kbd>Ctrl</kbd> + <kbd>Option</kbd> のいずれかです。</p>
+
+<p>VO にはたくさんのキーボードコマンドがありますので、ここではそれら全てをリストしません。 ウェブページのテストに必要な基本的なものは、次の表のとおりです。 キーボードショートカットでは、<kbd>VO</kbd> は「VoiceOver 修飾キー」を意味します。</p>
+
+<table class="standard-table">
+ <caption>最も一般的な VoiceOver のキーボードショートカット</caption>
+ <thead>
+ <tr>
+ <th scope="col">キーボードショートカット</th>
+ <th scope="col">説明</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>矢印キー</kbd></td>
+ <td>VO カーソルを上下左右に移動します。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>スペースバー</kbd></td>
+ <td>VO カーソルで強調表示されている項目を選択/アクティブ化します。 これには、ローター(下記参照)で選択した項目が含まれます。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>Shift</kbd> + <kbd>下矢印</kbd></td>
+ <td>(HTML の表やフォームなどの)項目のグループ内に入ります。 グループ内に入ると、通常どおり上記のコマンドを使用してそのグループ内の項目を移動して選択できます。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>Shift</kbd> + <kbd>上矢印</kbd></td>
+ <td>グループから出ます。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>C</kbd></td>
+ <td>(表内の場合)現在の列のヘッダーを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>R</kbd></td>
+ <td>(表内の場合)現在の行のヘッダーを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>C</kbd> + <kbd>C</kbd>(2つの連続した C)</td>
+ <td>(表内の場合)ヘッダーを含む現在の列全体を読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>R</kbd> + <kbd>R</kbd>(2つの連続した R)</td>
+ <td>(表内の場合)各セルに対応するヘッダーを含め、現在の行全体を読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>左矢印</kbd>、<kbd>VO</kbd> + <kbd>右矢印</kbd></td>
+ <td>(日付の選択や時刻の選択などの一部の水平オプション内の場合)オプション間を移動します。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>上矢印</kbd>、<kbd>VO</kbd> + <kbd>下矢印</kbd></td>
+ <td>(日付の選択や時刻の選択などの一部の水平オプション内の場合)現在のオプションを変更します。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>U</kbd></td>
+ <td>簡単にナビゲーションできるように、見出し、リンク、フォームコントロールなどのリストを表示するローターを使用します。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>左矢印</kbd>、<kbd>VO</kbd> + <kbd>右矢印</kbd></td>
+ <td>(ローター内の場合)ローターで利用可能な異なるリスト間を移動します。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>上矢印</kbd>、<kbd>VO</kbd> + <kbd>下矢印</kbd></td>
+ <td>(ローター内の場合)現在のローターリスト内の異なる項目間を移動します。</td>
+ </tr>
+ <tr>
+ <td><kbd>Esc</kbd></td>
+ <td>(ローター内の場合)ローターを終了します。</td>
+ </tr>
+ <tr>
+ <td><kbd>Ctrl</kbd></td>
+ <td>(VO が話している場合)読み上げを一時停止/再開します。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>Z</kbd></td>
+ <td>読み上げの最後の部分をやり直します。</td>
+ </tr>
+ <tr>
+ <td><kbd>VO</kbd> + <kbd>D</kbd></td>
+ <td>Mac の Dock に入るので、その中で実行するアプリを選択できます。</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>これはたくさんのコマンドのように思えますが、慣れればそれほど悪くはありません。 VO は、特定の場所でどのコマンドを使用するかについて定期的に注意を促します。 今は VO で遊びましょう。 その後、{{anch("Screenreader testing","スクリーンリーダーのテスト")}}のセクションで例のいくつかを試してみることができます。</p>
+
+<h4 id="NVDA" name="NVDA">NVDA</h4>
+
+<p>NVDA は Windows 専用で、インストールする必要があります。</p>
+
+<ol>
+ <li><a href="http://www.nvaccess.org/">nvaccess.org</a> からダウンロードしてください。 寄付をするか無料でダウンロードするかを選択できます。 ダウンロードできるようになる前にあなたのメールアドレスを与える必要もあるでしょう。</li>
+ <li>ダウンロードしたら、インストールします — インストーラをダブルクリックし、ライセンスに同意して指示に従います。</li>
+ <li>NVDA を起動するには、プログラムファイル/ショートカットをダブルクリックするか、キーボードショートカットの <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>N</kbd> を使用します。 起動すると NVDA にようこそダイアログが表示されます。 ここでは、いくつかのオプションから選択し、次に [OK] ボタンを押して作業を進めます。</li>
+</ol>
+
+<p>これで NVDA はあなたのコンピュータ上でアクティブになります。</p>
+
+<p>NVDA を使用するには、「NVDA 修飾キー」を多用します — これは、実際の NVDA のキーボードショートカットに加えて、それらを機能させるために押す必要があるキーです。 このような修飾キーを使用するのは、スクリーンリーダーに共通で、他のコマンドとコマンドが衝突しないようにするためです。 NVDA の場合、修飾キーは <kbd>Insert</kbd>(デフォルト)、または <kbd>CapsLock</kbd>([OK] を押す前に NVDA へようこそダイアログボックスの最初のチェックボックスをオンにして選択できます)のいずれかになります。</p>
+
+<div class="note">
+<p><strong>注</strong>: NVDA は、VoiceOver よりも、それがどこにあるのか、また何をしているのかを強調する方法という点では微妙です。 あなたが見出しやリストなどをスクロールしているとき、あなたが選択している項目は一般的に微妙なアウトラインでハイライトされますが、これはいつも全てのことに当てはまるわけではありません。 完全に迷子になった場合は、<kbd>Ctrl</kbd> + <kbd>F5</kbd> を押して現在のページを更新し、もう一度上から始めることができます。</p>
+</div>
+
+<p>NVDA にはたくさんのキーボードコマンドがありますので、ここではそれら全てをリストしません。 ウェブページのテストに必要な基本的なものは、次の表のとおりです。 キーボードショートカットでは、<kbd>NVDA</kbd> は「NVDA 修飾キー」を意味します。</p>
+
+<table class="standard-table">
+ <caption>最も一般的な NVDA のキーボードショートカット</caption>
+ <thead>
+ <tr>
+ <th scope="col">キーボードショートカット</th>
+ <th scope="col">説明</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><kbd>NVDA</kbd> + <kbd>Q</kbd></td>
+ <td>起動している NVDA を再びオフにします。</td>
+ </tr>
+ <tr>
+ <td><kbd>NVDA</kbd> + <kbd>上矢印</kbd></td>
+ <td>現在行を読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>NVDA</kbd> + <kbd>下矢印</kbd></td>
+ <td>現在位置から読み上げを始めます。</td>
+ </tr>
+ <tr>
+ <td><kbd>上矢印</kbd> と <kbd>下矢印</kbd>、または <kbd>Shift</kbd> + <kbd>Tab</kbd> と <kbd>Tab</kbd></td>
+ <td>ページ内の前/次の項目に移動して、それを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>左矢印</kbd> と <kbd>右矢印</kbd></td>
+ <td>現在の項目の前/次の文字に移動して、それを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>H</kbd> と <kbd>H</kbd></td>
+ <td>前/次の見出しに移動して、それを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>K</kbd> と <kbd>K</kbd></td>
+ <td>前/次のリンクに移動して、それを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>D</kbd> と <kbd>D</kbd></td>
+ <td>前/次の文書のランドマーク(<code>&lt;nav&gt;</code> など)に移動して、それを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>1</kbd> 〜 <kbd>6</kbd> と <kbd>1</kbd> 〜 <kbd>6</kbd></td>
+ <td>前/次の見出し(レベル 1 〜 6)に移動して読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>F</kbd> と <kbd>F</kbd></td>
+ <td>前/次のフォーム入力に移動して、それにフォーカスを当てます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>T</kbd> と <kbd>T</kbd></td>
+ <td>前/次のデータ表に移動して、それにフォーカスを当てます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>B</kbd> と <kbd>B</kbd></td>
+ <td>前/次のボタンに移動して、ラベルを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>L</kbd> と <kbd>L</kbd></td>
+ <td>前/次のリストに移動して、その最初のリスト項目を読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>I</kbd> と <kbd>I</kbd></td>
+ <td>前/次のリスト項目に移動して、それを読み上げます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Enter</kbd> / <kbd>Return</kbd></td>
+ <td>(リンク/ボタンまたは他のアクティブ化可能項目が選択されている場合)項目をアクティブ化します。</td>
+ </tr>
+ <tr>
+ <td><kbd>NVDA</kbd> + <kbd>スペースバー</kbd></td>
+ <td>(フォームが選択されている場合)個々の項目を選択できるようにフォーム内に入るか、すでにフォームに入っている場合はフォームから出ます。</td>
+ </tr>
+ <tr>
+ <td><kbd>Shift</kbd> + <kbd>Tab</kbd> と <kbd>Tab</kbd></td>
+ <td>(フォーム内の場合)フォーム入力間を移動します。</td>
+ </tr>
+ <tr>
+ <td><kbd>上矢印</kbd> と <kbd>下矢印</kbd></td>
+ <td>(フォーム内の場合)フォーム入力の値を変更します(選択ボックスなどの場合)。</td>
+ </tr>
+ <tr>
+ <td><kbd>スペースバー</kbd></td>
+ <td>(フォーム内の場合)選択値を選択します。</td>
+ </tr>
+ <tr>
+ <td><kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>矢印キー</kbd></td>
+ <td>(表が選択されている場合)表のセル間を移動します。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h4 id="Screenreader_testing" name="Screenreader_testing">スクリーンリーダーのテスト</h4>
+
+<p>スクリーンリーダーを使用することに慣れてきましたが、スクリーンリーダーがどのようにウェブページの良い機能と悪い機能に対処するかを理解するために、簡単なアクセシビリティテストを行うためにスクリーンリーダーを使用したいと思います。</p>
+
+<ul>
+ <li><a href="http://mdn.github.io/learning-area/accessibility/html/good-semantics.html">good-semantics.html</a> を見て、見出しがスクリーンリーダーによってどのように見つけられ、ナビゲーションに使用できるかに注目してください。 では、<a href="http://mdn.github.io/learning-area/accessibility/html/bad-semantics.html">bad-semantics.html</a> を見て、スクリーンリーダーがどのようにしてこの情報を取得できないのかに注目してください。 本当に長いページのテキストをナビゲートしようとすると、これがどれほど面倒なことになるか想像してください。</li>
+ <li><a href="http://mdn.github.io/learning-area/accessibility/html/good-links.html">good-links.html</a> を見て、コンテキストから見たときにそれらがどのように意味をなすかに注目してください。 <a href="http://mdn.github.io/learning-area/accessibility/html/bad-links.html">bad-links.html</a> ではそうではありません — それらは全てただの「ここをクリック」です。</li>
+ <li><a href="http://mdn.github.io/learning-area/accessibility/html/good-form.html">good-form.html</a> を見て、<code>&lt;label&gt;</code> 要素を適切に使用することで、フォーム入力がラベルでどのように説明されるかに注目してください。 <a href="http://mdn.github.io/learning-area/accessibility/html/bad-form.html">bad-form.html</a> では、それらは「空白」の行に沿って役に立たないラベルを取得します。</li>
+ <li><a href="http://mdn.github.io/learning-area/css/styling-boxes/styling-tables/punk-bands-complete.html">punk-bands-complete.html</a> の例を見て、ヘッダーを正しく定義したので、スクリーンリーダーがどのようにしてコンテンツの列と行を関連付け、それらを全て読み取ることができるかを確認します。 <a href="http://mdn.github.io/learning-area/accessibility/html/bad-table.html">bad-table.html</a> では、どのセルも関連付けることができません。 1つのページに1つの表しかない場合、NVDA はやや奇妙なふるまいをするようです。 代わりに <a href="http://webaim.org/articles/nvda/tables.htm">WebAIM の表のテストのページ</a>(英語)を試すことができます。</li>
+ <li>先ほど見た <a href="http://www.freedomscientific.com/Training/Surfs-up/AriaLiveRegions.htm">WAI-ARIA のライブリージョンの例</a>(英語)を見て、スクリーンリーダーが絶えず更新されているセクションが更新されるたびにそれを読み上げていくかに注目してください。</li>
+</ul>
+
+<h3 id="User_testing" name="User_testing">ユーザーテスト</h3>
+
+<p>上記のように、あなたはあなたのサイトのアクセシビリティ問題を決定するために自動化されたツールだけに頼ることはできません。 テスト計画を立てる際には、可能であればアクセシビリティユーザーグループをいくつか含めることをお勧めします(詳細については、コースの前半の<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies#User_testing">ユーザーテスト</a>のセクションを参照してください)。 必要に応じて、スクリーンリーダーを使用するユーザー、キーボードを使用するユーザー、聴覚を持たないユーザー、および他のグループも参加してください。</p>
+
+<h2 id="Accessibility_testing_checklist" name="Accessibility_testing_checklist">アクセシビリティテストのチェックリスト</h2>
+
+<p>次のリストは、プロジェクトで推奨されるアクセシビリティテストを確実に実行したことを確認するためのチェックリストです。</p>
+
+<ol>
+ <li>HTML が意味論的にできるだけ正しいことを確認してください。 <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Auditing_tools">監査ツール</a>を使用して、<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Validation">それを検証する</a>ことは良いスタートです。</li>
+ <li>CSS がオフになっているときにコンテンツが意味をなすことを確認してください。</li>
+ <li>機能が<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Using_native_keyboard_accessibility">キーボードからアクセス可能であること</a>を確認してください。 <kbd>Tab</kbd>、<kbd>Return</kbd> / <kbd>Enter</kbd> などを使ってテストします。</li>
+ <li>テキスト以外のコンテンツに<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Text_alternatives">代替テキスト</a>があることを確認してください。 <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Auditing_tools">監査ツール</a>はそのような問題を捉えるのに適しています。</li>
+ <li>適切なチェックツールを使用して、サイトの<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Color_and_color_contrast">カラーコントラスト</a>が許容範囲内であることを確認してください。</li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Hiding_content">隠されたコンテンツ</a>がスクリーンリーダーに見えるようにしてください。</li>
+ <li>可能な限り JavaScript がなくても機能が使えることを確認してください。</li>
+ <li>適切な場合は、ARIA を使用してアクセシビリティを向上させます。</li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Auditing_tools">監査ツール</a>を通してサイトを運営してください。</li>
+ <li>スクリーンリーダーでテストしてください。</li>
+ <li>あなたが行ったことを言うために、あなたのサイトのどこかに見つけることができるアクセシビリティの方針/声明を含めてください。</li>
+</ol>
+
+<h2 id="Finding_help" name="Finding_help">助けを探す</h2>
+
+<p>あなたがアクセシビリティに関して遭遇するであろう他の多くの問題があります。 本当に知っておくべき最も重要なことは、オンラインで答えを見つける方法です。 HTML と CSS の記事の<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Finding_help">助けを探すのセクション</a>を参考にしてください。</p>
+
+<h2 id="Summary" name="Summary">まとめ</h2>
+
+<p>たぶん、この記事はあなたが遭遇するかもしれない主なアクセシビリティ問題とそれらをどうやってテストして克服するかについての良い下地を与えたでしょう。</p>
+
+<p>次の記事では、機能の検出について詳しく説明します。</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/JavaScript","Learn/Tools_and_testing/Cross_browser_testing/Feature_detection", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+<h2 id="In_this_module" name="In_this_module">このモジュール内の文書</h2>
+
+<ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">はじめてのクロスブラウザーテスト</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">テスト実行戦略</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">よくある HTML や CSS の問題を扱う</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">よくある JavaScript の問題を扱う</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">よくあるアクセシビリティの問題を扱う</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">機能検出の実装</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">はじめての自動テスト</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">テスト自動化環境をセットアップする</a></li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/automated_testing/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/automated_testing/index.html
new file mode 100644
index 0000000000..98bf8d9394
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/automated_testing/index.html
@@ -0,0 +1,620 @@
+---
+title: 自動テストのイントロダクション
+slug: Learn/Tools_and_testing/Cross_browser_testing/Automated_testing
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/Automated_testing
+---
+<div> {{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Feature_detection", "Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">1日に数回、複数のブラウザやデバイスで手動でテストを実行すると、面倒で時間がかかる場合があります。これを効率的に処理するには、自動化ツールに慣れておく必要があります。この記事では、利用可能なもの、タスクランナーの使い方、そして Sauce Labs や Browser Stack などの市販のブラウザテスト自動化アプリケーションの基本的な使い方を見ていきます。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td>主要な <a href="/ja/docs/Learn/HTML">HTML</a>、<a href="/ja/docs/Learn/CSS">CSS</a>、および <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語に精通していること。<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">クロスブラウザテストの原則</a>の高水準のアイデア。</td>
+ </tr>
+ <tr>
+ <th scope="row">目標:</th>
+ <td>自動テストにはどのようなものが含まれているのか、それがどのようにあなたの生活を楽にすることができるのか、そして物事を楽にするいくつかの商用製品をどのように利用するかの理解を提供する。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Automation_makes_things_easy">Automation makes things easy</h2>
+
+<p>Throughout this module we have detailed loads of different ways in which you can test your websites and apps, and explained the sort of scope your cross-browser testing efforts should have in terms of what browsers to test, accessibility considerations, and more. Sounds like a lot of work, doesn't it?</p>
+
+<p>We agree — testing all the things we've looked at in previous articles manually can be a real pain. Fortunately, there are tools to help us automate some of this pain away. There are two main ways in which we can automate the tests we've been talking about in this module:</p>
+
+<ol>
+ <li>Use a task runner such as <a href="http://gruntjs.com/">Grunt</a> or <a href="http://gulpjs.com/">Gulp</a>, or <a href="https://docs.npmjs.com/misc/scripts">npm scripts</a> to run tests and clean up code during your build process. This is a great way to perform tasks like linting and minifying code, adding in CSS prefixes or transpiling nascent JavaScript features for maximum cross-browser reach, and so on.</li>
+ <li>Use a browser automation system like <a href="http://www.seleniumhq.org/">Selenium</a> to run specific tests on installed browsers and return results, alerting you to failures in browsers as they crop up. Commercial cross-browser testing apps like <a href="https://saucelabs.com/">Sauce Labs</a> and <a href="https://www.browserstack.com/">Browser Stack</a> are based on Selenium, but allow you to access their set up remotely using a simple interface, saving you the hassle of setting up your own testing system.</li>
+</ol>
+
+<p>We will look at how to set up your own Selenium-based testing system in the next article. In this article, we'll look at how to set up a task runner, and use the basic functionality of commercial systems like the ones mentioned above.</p>
+
+<div class="note">
+<p><strong>Note</strong>: the above two categories are not mutually exclusive. It is possible to set up a task runner to access a service like Sauce Labs via an API, run cross browser tests, and return results. We will look at this below as well.</p>
+</div>
+
+<h2 id="Using_a_task_runner_to_automate_testing_tools">Using a task runner to automate testing tools</h2>
+
+<p>As we said above, you can drastically speed up common tasks such as linting and minifying code by using a task runner to run everything you need to run automatically at a certain point in your build process. For example, this could be every time you save a file, or at some other point. Inside this section we'll look at how to automate task running with Node and Gulp, a beginner-friendly option.</p>
+
+<h3 id="Setting_up_Node_and_npm">Setting up Node and npm</h3>
+
+<p>Most tools these days are based on {{Glossary("Node.js")}}, so you'll need to install it from <a href="https://nodejs.org/">nodejs.org</a>:</p>
+
+<ol>
+ <li>Download the installer for your system from the above site. (If you already have Node and npm installed, jump to point 4)</li>
+ <li>Install it like you would any other program. Note that Node comes with <a href="https://www.npmjs.com/">Node Package Manager</a> (npm), which allows you to easily install packages, share your own packages with others, and run useful scripts on your projects.</li>
+ <li>Once the install completes, test that node is installed by typing the following into the terminal, which returns the installed versions of Node and npm:
+ <pre class="brush: bash">node -v
+npm -v</pre>
+ </li>
+ <li>If you've got Node/npm already installed, you should update them to their latest versions. To update Node, the most reliable way is to download and install an updated installer package from their website (see link above). To update npm, use the following command in your terminal:
+ <pre class="brush: bash">npm install npm@latest -g</pre>
+ </li>
+</ol>
+
+<div class="note">
+<p><strong>Note</strong>: If the above command fails with permissions errors, <a href="https://docs.npmjs.com/getting-started/fixing-npm-permissions">Fixing npm permissions</a> should sort you out.</p>
+</div>
+
+<p>To start using Node/npm-based packages on your projects, you need to set up your project directories as npm projects. This is easy to do.</p>
+
+<p>For example, let's first create a test directory to allow us to play without fear of breaking anything.</p>
+
+<ol>
+ <li>Create a new directory somewhere sensible with using your file manager UI, or by navigating to the location you want and running the following command:
+ <pre class="brush: bash">mkdir node-test</pre>
+ </li>
+ <li>To make this directory an npm project, you just need to go inside your test directory and initialize it, with the following:
+ <pre class="brush: bash">cd node-test
+npm init</pre>
+ </li>
+ <li>This second command will ask you many questions to find out the information required to set up the project; you can just select the defaults for now.</li>
+ <li>Once all the questions have been asked, it will ask you if the information entered is OK. type <code>yes</code> and press Enter/Return and npm will generate a <code>package.json</code> file in your directory.</li>
+</ol>
+
+<p>This file is basically a config file for the project. You can customize it later, but for now it'll look something like this:</p>
+
+<pre class="brush: json">{
+ "name": "node-test",
+ "version": "1.0.0",
+ "description": "Test for npm projects",
+ "main": "index.js",
+ "scripts": {
+ "test": "test"
+ },
+ "author": "Chris Mills",
+ "license": "MIT"
+}</pre>
+
+<p>With this, you are ready to move on.</p>
+
+<h3 id="Setting_up_Gulp_automation">Setting up Gulp automation</h3>
+
+<p>Let's look at setting up Gulp and using it to automate some testing tools.</p>
+
+<ol>
+ <li>To begin with, create a test npm project using the procedure detailed at the bottom of the previous section.</li>
+ <li>Next, you'll need some sample HTML, CSS and JavaScript content to test your system on — make copies of our sample <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/automation/index.html">index.html</a>, <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/automation/main.js">main.js</a>, and <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/automation/style.css">style.css</a> files in a subfolder with the name <code>src</code> inside your project folder. You can try your own test content if you like, but bear in mind that such tools won't work on internal JS/CSS — you need external files.</li>
+ <li>First, install gulp globally (meaning, it will be available across all projects) using the following command:
+ <pre class="brush: bash">npm install --global gulp-cli</pre>
+ </li>
+ <li>Next, run the following command inside your npm project directory root to set up gulp as a dependency of your project:
+ <pre class="brush: bash">npm install --save-dev gulp</pre>
+ </li>
+ <li>Now create a new file inside your project directory called <code>gulpfile.js</code>. This is the file that will run all our tasks. Inside this file, put the following:
+ <pre class="brush: js">var gulp = require('gulp');
+
+gulp.task('default', function() {
+ console.log('Gulp running');
+});</pre>
+ This requires the <code>gulp</code> module we installed earlier, and then runs a basic task that does nothing except for printing a message to the terminal — this is useful for letting us know that Gulp is working. Each gulp task is written in the same basic format — <code>gulp</code>'s <code>task()</code> method is run, and given two parameters — the name of the task, and a callback function containing the actual code to run to complete the task.</li>
+ <li>You can run your gulp task with the following commands — try this now:
+ <pre class="brush: bash">gulp
+</pre>
+ </li>
+</ol>
+
+<h3 id="Adding_some_real_tasks_to_Gulp">Adding some real tasks to Gulp</h3>
+
+<p>To add some real tasks to Gulp, we need to think about what we want to do. A reasonable set of basic functionalities to run on our project is as follows:</p>
+
+<ul>
+ <li>html-tidy, css-lint, and js-hint to lint and report/fix common HTML/CSS/JS errors (see <a href="https://www.npmjs.com/package/gulp-htmltidy/">gulp-htmltidy</a>, <a href="https://www.npmjs.com/package/gulp-csslint/">gulp-csslint</a>, <a href="https://www.npmjs.com/package/gulp-jshint/">gulp-jshint</a>).</li>
+ <li>Autoprefixer to scan our CSS and add vendor prefixes only where needed (see <a href="https://www.npmjs.com/package/gulp-autoprefixer/">gulp-autoprefixer</a>).</li>
+ <li>babel to transpile any new JavaScript syntax features to traditional syntax that works in older browsers (see <a href="https://www.npmjs.com/package/gulp-babel/">gulp-babel</a>).</li>
+</ul>
+
+<p>See the links above for full instructions on the different gulp packages we are using.</p>
+
+<p>To use each plugin, you need to first install it via npm, then require any dependencies at the top of the <code>gulpfile.js</code> file, then add your test(s) to the bottom of it, and finally add the name of your task inside the <code>default</code> task.</p>
+
+<p>Before you go any further, update the default task to this:</p>
+
+<pre class="brush: js">gulp.task('default', [ ]);</pre>
+
+<p>Inside the array goes the names of all the tasks you want Gulp to run, once you run the <code>gulp</code> command on the command line.</p>
+
+<h4 id="html-tidy">html-tidy</h4>
+
+<ol>
+ <li>Install using the following line:
+ <pre class="brush: bash"><span class="text"><span>npm install --save-dev gulp-htmltidy</span></span>
+</pre>
+
+ <div class="note">
+ <p><strong>Note</strong>: <code>--save-dev</code> adds the package as a dependency to your project. If you look in your project's <code>package.json</code> file, you'll see an entry for it as, it has been added to the <code>devDependencies</code> property.</p>
+ </div>
+ </li>
+ <li class="line">Add the following dependencies to <code>gulpfile.js</code>:
+ <pre class="brush: js">var htmltidy = require('gulp-htmltidy');</pre>
+ </li>
+ <li>Add the following test to the bottom of <code>gulpfile.js</code>:
+ <pre class="brush: js">gulp.task('html', function() {
+ return gulp.src('src/index.html')
+ .pipe(htmltidy())
+ .pipe(gulp.dest('build'));
+});</pre>
+ </li>
+ <li>Add <code>'html'</code> as an item inside the array in the <code>default</code> task.</li>
+</ol>
+
+<p>Here we are grabbing our development <code>index.html</code> file — <code>gulp.src()</code> which allows us to grab a source file to do something with.</p>
+
+<p>We next use the <code>pipe()</code> function to pass that source to another command to do something else with. We can chain as many of these together as we want. We first run <code>htmltidy()</code> on the source, which goes through and fixes errors in our file. The second <code>pipe()</code> function writes the output HTML file to the <code>build</code> directory.</p>
+
+<p>In the input version of the file, you may have noticed that we put an empty {{htmlelement("p")}} element; htmltidy has removed this by the time the output file has been created.</p>
+
+<h4 id="Autoprefixer_and_css-lint">Autoprefixer and css-lint</h4>
+
+<ol>
+ <li>Install using the following lines:
+ <pre class="brush: bash">npm install --save-dev gulp-autoprefixer
+npm install --save-dev gulp-csslint</pre>
+ </li>
+ <li>Add the following dependencies to <code>gulpfile.js</code>:
+ <pre class="brush: js">var autoprefixer = require('gulp-autoprefixer');
+var csslint = require('gulp-csslint');</pre>
+ </li>
+ <li>Add the following test to the bottom of <code>gulpfile.js</code>:
+ <pre class="brush: js">gulp.task('css', function() {
+ return gulp.src('src/style.css')
+ .pipe(csslint())
+ .pipe(csslint.formatter('compact'))
+ .pipe(autoprefixer({
+ browsers: ['last 5 versions'],
+ cascade: false
+ }))
+ .pipe(gulp.dest('build'));
+});</pre>
+ </li>
+ <li>Add <code>'css'</code> as an item inside the array in the <code>default</code> task.</li>
+</ol>
+
+<p>Here we grab our <code>style.css</code> file, run csslint on it (which outputs a list of any errors in your CSS to the terminal), then runs it through autoprefixer to add any prefixes needed to make nascent CSS features run in older browsers. At the end of the pipe chain, we output our modified prefixed CSS to the <code>build </code>directory. Note that this only works if csslint doesn't find any errors — try removing a curly brace from your CSS file and re-running gulp to see what output you get!</p>
+
+<h4 id="js-hint_and_babel">js-hint and babel</h4>
+
+<ol>
+ <li>Install using the following lines:
+ <pre class="editor editor-colors">npm install --save-dev gulp-babel @babel/preset-env
+npm install --save-dev @babel/core
+<span class="shell source"><span>npm install jshint gulp-jshint --save-dev</span></span>
+</pre>
+ </li>
+ <li>Add the following dependencies to <code>gulpfile.js</code>:
+ <pre class="editor editor-colors">var babel = require('gulp-babel');
+<span class="js source"><span class="js storage type"><span>var</span></span><span> jshint </span><span class="assignment js keyword operator"><span>=</span></span><span> </span><span class="function-call js meta"><span class="function js support"><span>require</span></span><span class="js meta"><span class="begin definition js punctuation round"><span>(</span></span><span class="js quoted single string"><span class="begin definition js punctuation string"><span>'</span></span><span>gulp-jshint</span><span class="definition end js punctuation string"><span>'</span></span></span><span class="definition end js punctuation round"><span>)</span></span></span></span><span class="js punctuation statement terminator"><span>;</span></span></span>
+</pre>
+ </li>
+ <li class="line">Add the following test to the bottom of <code>gulpfile.js</code>:
+ <pre class="brush: js">gulp.task('js', function() {
+    return gulp.src('src/main.js')
+        .pipe(jshint())
+        .pipe(jshint.reporter('default'))
+        .pipe(babel({
+            presets: ['@babel/env']
+        }))
+        .pipe(gulp.dest('build'));
+});</pre>
+ </li>
+ <li>Add <code>'js'</code> as an item inside the array in the <code>default</code> task.</li>
+</ol>
+
+<p>Here we grab our <code>main.js</code> file, run <code>jshint</code> on it and output the results to the terminal using <code>jshint.reporter</code>; we then pass the file to babel, which converts it to old style syntax and outputs the result into the <code>build</code> directory. Our original code included a <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">fat arrow function</a>, which babel has modified into an old style function.</p>
+
+<h4 id="Further_ideas">Further ideas</h4>
+
+<p>Once all this is all set up, you can run the <code>gulp</code> command inside your project directory, and you should get an output like this:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14227/gulp-output.png" style="display: block; height: 478px; margin: 0px auto; width: 697px;"></p>
+
+<p>You can then try out the files output by your automated tasks by looking at them inside the <code>build</code> directory, and loading <code>build/index.html</code> in your web browser.</p>
+
+<p>If you get errors, check that you've added all the dependencies and the tests as shown above; also try commenting out the HTML/CSS/JavaScript code sections and then rerunning gulp to see if you can isolate what the problem is.</p>
+
+<p>Gulp comes with a <code>watch()</code> function that you can use to watch your files and run tests whenever you save a file. For example, try adding the following to the bottom of your <code>gulpfile.js</code>:</p>
+
+<pre class="brush: js">gulp.task('watch', function(){
+ gulp.watch('src/*.html', ['html']);
+ gulp.watch('src/*.css', ['css']);
+ gulp.watch('src/*.js', ['js']);
+});</pre>
+
+<p>Now try entering the <code>gulp watch</code> command into your terminal. Gulp will now watch your directory, and run the appropriate tasks whenever you save a change to an HTML, CSS, or JavaScript file.</p>
+
+<div class="note">
+<p><strong>Note</strong>: The <code>*</code> character is a wildcard character — here we're saying "run these tasks when any files of these types are saved. You could also use wildcards in your main tasks, for example <code>gulp.src('src/*.css')</code> would grab all your CSS files and then run piped tasks on them.</p>
+</div>
+
+<div class="note">
+<p><strong>Note</strong>: One problem with our watch command above is that our CSSLint/Autoprefixer combination throws full-blown errors when a CSS error is encountered, which stops the watch working. You'll have to restart the watch once a CSS error is encountered, or find another way to do this.</p>
+</div>
+
+<p>There's a lot more you can do with Gulp. The <a href="http://gulpjs.com/plugins/">Gulp plugin directory</a> has literally thousands of plugins to search through.</p>
+
+<h3 id="Other_task_runners">Other task runners</h3>
+
+<p>There are many other task runners available. We certainly aren't trying to say that Gulp is the best solution out there, but it works for us and it is fairly accessible to beginners. You could also try using other solutions:</p>
+
+<ul>
+ <li>Grunt works in a very similar way to Gulp, except that it relies on tasks specified in a config file, rather than using written JavaScript. See <a href="http://gruntjs.com/getting-started">Getting started with Grunt for more details.</a></li>
+ <li>You can also run tasks directly using npm scripts located inside your <code>package.json</code> file, without needing to install any kind of extra task runner system. This works on the premise that things like Gulp plugins are basically wrappers around command line tools. So, if you can work out how to run the tools using the command line, you can then run them using npm scripts. It is a bit trickier to work with, but can be rewarding for those who are strong with their command line skills.<a href="https://css-tricks.com/why-npm-scripts/"> Why npm scripts?</a> provides a good introduction with a good deal of further information.</li>
+</ul>
+
+<h2 id="Using_commercial_testing_services_to_speed_up_browser_testing">Using commercial testing services to speed up browser testing</h2>
+
+<p>Now let's look at commercial 3rd party browser testing services and what they can do for us.</p>
+
+<p>The basic premise with such applications is that the company that runs each one has a huge server farm that can run many different tests. When you use this service, you provide a URL of the page you want to test along with information, such as what browsers you want it tested in. The app then configures a new VM with the OS and browser you specified, and returns the test results in the form of screenshots, videos, logfiles, text, etc.</p>
+
+<p>You can then step up a gear, using an API to access functionality programmatically, which means that such apps can be combined with task runners, such as your own local Selenium environments and others, to create automated tests.</p>
+
+<div class="note">
+<p><strong>Note</strong>: There are other commercial browser testing systems available but in this article, we'll focus on Sauce Labs and BrowserStack. We're not saying that these are necessarily the best tools available, but they are good ones that are simple for beginners to get up and running with.</p>
+</div>
+
+<h3 id="Sauce_Labs">Sauce Labs</h3>
+
+<h4 id="Getting_started_with_Sauce_Labs">Getting started with Sauce Labs</h4>
+
+<p>Let's get started with a Sauce Labs Trial.</p>
+
+<ol>
+ <li>Create a <a href="https://saucelabs.com/signup/trial">Sauce Labs trial account</a>.</li>
+ <li>Sign in. This should happen automatically after you verify your e-mail address.</li>
+</ol>
+
+<h4 id="The_basics_Manual_tests">The basics: Manual tests</h4>
+
+<p>The <a href="https://saucelabs.com/beta/dashboard/manual">Sauce Labs dashboard</a> has a lot of options available on it. For now, make sure you are on the <em>Manual Tests</em> tab.</p>
+
+<ol>
+ <li>Click <em>Start a new manual session</em>.</li>
+ <li>In the next screen, type in the URL of a page you want to test (use <a href="http://mdn.github.io/learning-area/javascript/building-blocks/events/show-video-box-fixed.html">http://mdn.github.io/learning-area/javascript/building-blocks/events/show-video-box-fixed.html</a>, for example), then choose a browser/OS combination you want to test by using the different buttons and lists. There is a lot of choice, as you'll see! <img alt="" src="https://mdn.mozillademos.org/files/14229/sauce-manual-session.png" style="border-style: solid; border-width: 1px; display: block; height: 636px; margin: 0px auto; width: 600px;"></li>
+ <li>When you click Start session, a loading screen will then appear, which spins up a virtual machine running the combination you chose.</li>
+ <li>When loading has finished, you can then start to remotely test the web site running in the chosen browser. <img alt="" src="https://mdn.mozillademos.org/files/14231/sauce-test-running.png" style="display: block; height: 390px; margin: 0px auto; width: 800px;"></li>
+ <li>From here you can see the layout as it would look in the browser you are testing, move the mouse around and try clicking buttons, etc. The top menu allows you to:
+ <ul>
+ <li>Stop the session</li>
+ <li>Give someone else a URL so they can observe the test remotely.</li>
+ <li>Copy text/notes to a remote clipboard.</li>
+ <li>Take a screenshot.</li>
+ <li>Test in full screen mode.</li>
+ </ul>
+ </li>
+</ol>
+
+<p>Once you stop the session, you'll return to the Manual Tests tab, where you'll see an entry for each of the previous manual sessions you started. Clicking on one of these entries shows more data for the session. In here you can download any screenshots you took , watch a video of the session, and view data logs for the session for example.</p>
+
+<div class="note">
+<p><strong>Note</strong>: This is already very useful, and way more convenient than having to set up all these emulators and virtual machines by yourself.</p>
+</div>
+
+<h4 id="Advanced_The_Sauce_Labs_API">Advanced: The Sauce Labs API</h4>
+
+<p>Sauce Labs has a <a href="https://wiki.saucelabs.com/display/DOCS/The+Sauce+Labs+REST+API">restful API</a> that allows you to programmatically retrieve details of your account and existing tests, and annotate tests with further details, such as their pass/fail state which isn't recordable by manual testing alone. For example, you might want to run one of your own Selenium tests remotely using Sauce Labs, to test a certain browser/OS combination, and then pass the test results back to Sauce Labs.</p>
+
+<p>It has several clients available to allow you to make calls to the API using your favourite environment, be it PHP, Java, Node.js, etc.</p>
+
+<p>Let's have a brief look at how we'd access the API using Node.js and <a href="https://github.com/danjenkins/node-saucelabs">node-saucelabs</a>.</p>
+
+<ol>
+ <li>First, set up a new npm project to test this out, as detailed in {{anch("Setting up Node and npm")}}. Use a different directory name than before, like <code>sauce-test</code> for example.</li>
+ <li>Install the Node Sauce Labs wrapper using the following command:
+ <pre>npm install saucelabs</pre>
+ </li>
+ <li>Create a new file inside your project root called <code>call_sauce.js</code>. give it the following contents:
+ <pre class="brush: js">var SauceLabs = require('saucelabs');
+
+var myAccount = new SauceLabs({
+ username: "your-sauce-username",
+ password: "your-sauce-api-key"
+});
+
+myAccount.getAccountDetails(function (err, res) {
+ console.log(res);
+ myAccount.getServiceStatus(function (err, res) {
+ // Status of the Sauce Labs services
+ console.log(res);
+ myAccount.getJobs(function (err, jobs) {
+ // Get a list of all your jobs
+ for (var k in jobs) {
+ if ( jobs.hasOwnProperty( k )) {
+ myAccount.showJob(jobs[k].id, function (err, res) {
+ var str = res.id + ": Status: " + res.status;
+ if (res.error) {
+ str += "\033[31m Error: " + res.error + " \033[0m";
+ }
+ console.log(str);
+ });
+ }
+ }
+ });
+ });
+});</pre>
+ </li>
+ <li>You'll need to fill in your Sauce Labs username and API key in the indicated places. These can be retrieved from your <a href="https://saucelabs.com/beta/user-settings">User Settings</a> page. Fill these in now.</li>
+ <li>Make sure everything is saved, and run your file like so:
+ <pre class="brush: bash">node call_sauce</pre>
+ </li>
+</ol>
+
+<h4 id="Advanced_Automated_tests">Advanced: Automated tests</h4>
+
+<p>We'll cover actually running automated Sauce Lab tests in the next article.</p>
+
+<h3 id="BrowserStack">BrowserStack</h3>
+
+<h4 id="Getting_started_with_BrowserStack">Getting started with BrowserStack</h4>
+
+<p>Let's get started with a BrowserStack Trial.</p>
+
+<ol>
+ <li>Create a <a href="https://www.browserstack.com/users/sign_up">BrowserStack trial account</a>.</li>
+ <li>Sign in. This should happen automatically after you verify your e-mail address.</li>
+ <li>When you first sign in, you should be on the Live testing page; if not, click the <em>Live</em> link in the top nav menu.</li>
+ <li>If you are on Firefox or Chrome, you'll be prompted to Install a browser extension in a dialog titled "Enable Local Testing" — click the <em>Install</em> button to proceed. If you are on other browsers you'll still be able to use some of the features (generally via Flash), but you won't get the full experience.</li>
+</ol>
+
+<h4 id="The_basics_Manual_tests_2">The basics: Manual tests</h4>
+
+<p>The BrowserStack Live dashboard allows you to choose what device and browser you want to test on — Platforms in the left column, devices on the right. When you mouse over or click on each device, you get a choice of browsers available on that device.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/15377/browserstack-test-choices-sized.png" style="border-style: solid; border-width: 1px; display: block; height: 339px; margin: 0px auto; width: 700px;"></p>
+
+<p>Clicking on one of those browser icons will load up your choice of platform/device/browser — choose one now, and give it a try.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/15379/browserstack-test-device-sized.png" style="border-style: solid; border-width: 1px; display: block; height: 841px; margin: 0px auto; width: 450px;"></p>
+
+<div class="note">
+<p><strong>Note</strong>: The blue device icon next to some of the mobile device choices signals that you will be testing on a real device; choices without that icon will be run on an emulator.</p>
+</div>
+
+<p>You'll find that you can enter URLs into the address bar, and use the other controls like you'd expect on a real device. You can even do things like copy and paste from the device to your clipboard, scroll up and down by dragging with the mouse, or use appropriate gestures (e.g. pinch/zoom, two fingers to scroll) on the touchpads of supporting devices (e.g. Macbook). Note that not all features are available on all devices.</p>
+
+<p>You'll also see a menu that allows you to control the session.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/15381/browserstack-test-menu-sized.png" style="border-style: solid; border-width: 1px; display: block; height: 636px; margin: 0px auto; width: 217px;"></p>
+
+<p>The features here are as follows:</p>
+
+<ul>
+ <li><em>Switch</em> — Change to another platform/device/browser combination.</li>
+ <li>Orientation (looks like a Reload icon) — Switch orientation between portrait and landscape.</li>
+ <li>Fit to screen (looks like a full screen icon) — Fill the testing areas as much as possible with the device.</li>
+ <li>Capture a bug (looks like a camera) — Takes a screenshot, then allows you to annotate and save it.</li>
+ <li>Issue tracker (looks like a deck of cards) — View previously captured bugs/screenshots.</li>
+ <li>Settings (cog icon) — Allows you to alter general settings for the session.</li>
+ <li>Help (question mark) — Accesses help/support functions.</li>
+ <li><em>Devtools</em> — Allows you to use your browser's devtools to directly debug or manipulate the page being shown in the test browser. This currently only works when testing the Safari browser on iOS devices.</li>
+ <li><em>Device info</em> — Displays information about the testing device.</li>
+ <li><em>Features</em> — Shows you what features the current configuration supports, e.g. copy to clipboard, gesture support, etc.</li>
+ <li><em>Stop</em> — Ends the session.</li>
+</ul>
+
+<div class="note">
+<p><strong>Note</strong>: This is already very useful, and way more convenient than having to set up all these emulators and virtual machines by yourself.</p>
+</div>
+
+<h4 id="Other_basic_features">Other basic features</h4>
+
+<p>If you go back to the main BrowserStack page, you'll find a couple of other useful basic features under the <em>More</em> menu option:</p>
+
+<ul>
+ <li><em>Responsive</em>: Enter a URL and press <em>Generate</em>, and BrowserStack will load that URL on multiple devices with different viewport sizes. Within each device you can further adjust settings like monitor size, to get a good idea of how your site's layout works across different form factors.</li>
+ <li><em>Screenshots</em>: Enter a URL, choose the browsers/devices/platforms you are interested in, then press <em>Generate screenshots</em> — Browserstack will take screenshots of your site in all those different browsers then make them available to you to view and download.</li>
+</ul>
+
+<h4 id="Advanced_The_BrowserStack_API">Advanced: The BrowserStack API</h4>
+
+<p>BrowserStack also has a <a href="https://www.browserstack.com/automate/rest-api">restful API</a> that allows you to programmatically retrieve details of your account plan, sessions, builds, etc.</p>
+
+<p>It has several clients available to allow you to make calls to the API using your favourite environment, be it PHP, Java, Node.js, etc.</p>
+
+<p>Let's have a brief look at how we'd access the API using Node.js.</p>
+
+<ol>
+ <li>First, set up a new npm project to test this out, as detailed in {{anch("Setting up Node and npm")}}. Use a different directory name than before, like <code>bstack-test</code> for example.</li>
+ <li>Create a new file inside your project root called <code>call_bstack.js</code>. give it the following contents:
+ <pre class="brush: js">var request = require("request");
+
+var bsUser = "BROWSERSTACK_USERNAME";
+var bsKey = "BROWSERSTACK_ACCESS_KEY";
+var baseUrl = "https://" + bsUser + ":" + bsKey + "@www.browserstack.com/automate/";
+
+function getPlanDetails(){
+ request({uri: baseUrl + "plan.json"}, function(err, res, body){
+ console.log(JSON.parse(body));
+ });
+ /* Response:
+ {
+ automate_plan: &lt;string&gt;,
+ parallel_sessions_running: &lt;int&gt;,
+ team_parallel_sessions_max_allowed: &lt;int&gt;,
+ parallel_sessions_max_allowed: &lt;int&gt;,
+ queued_sessions: &lt;int&gt;,
+ queued_sessions_max_allowed: &lt;int&gt;
+ }
+ */
+}
+
+getPlanDetails();
+</pre>
+ </li>
+ <li>You'll need to fill in your BrowserStack username and API key in the indicated places. These can be retrieved from your <a href="https://www.browserstack.com/automate">BrowserStack automation dashboard</a>. Fill these in now.</li>
+ <li>Make sure everything is saved, and run your file like so:
+ <pre class="brush: bash">node call_bstack</pre>
+ </li>
+</ol>
+
+<p>Below we've also provided some other ready-made functions you might find useful when working with the BrowserStack restful API.</p>
+
+<pre class="brush: js">function getBuilds(){
+ request({uri: baseUrl + "builds.json"}, function(err, res, body){
+ console.log(JSON.parse(body));
+ });
+ /* Response:
+ [
+ {
+ automation_build: {
+ name: &lt;string&gt;,
+ duration: &lt;int&gt;,
+ status: &lt;string&gt;,
+ hashed_id: &lt;string&gt;
+ }
+ },
+ {
+ automation_build: {
+ name: &lt;string&gt;,
+ duration: &lt;int&gt;,
+ status: &lt;string&gt;,
+ hashed_id: &lt;string&gt;
+ }
+ },
+ ...
+ ]
+ */
+};
+
+function getSessionsInBuild(build){
+ var buildId = build.automation_build.hashed_id;
+ request({uri: baseUrl + "builds/" + buildId + "/sessions.json"}, function(err, res, body){
+ console.log(JSON.parse(body));
+ });
+ /* Response:
+ [
+ {
+ automation_session: {
+ name: &lt;string&gt;,
+ duration: &lt;int&gt;,
+ os: &lt;string&gt;,
+ os_version: &lt;string&gt;,
+ browser_version: &lt;string&gt;,
+ browser: &lt;string&gt;,
+ device: &lt;string&gt;,
+ status: &lt;string&gt;,
+ hashed_id: &lt;string&gt;,
+ reason: &lt;string&gt;,
+ build_name: &lt;string&gt;,
+ project_name: &lt;string&gt;,
+ logs: &lt;string&gt;,
+ browser_url: &lt;string&gt;,
+ public_url: &lt;string&gt;,
+ video_url: &lt;string&gt;,
+ browser_console_logs_url: &lt;string&gt;,
+ har_logs_url: &lt;string&gt;
+ }
+ },
+ {
+ automation_session: {
+ name: &lt;string&gt;,
+ duration: &lt;int&gt;,
+ os: &lt;string&gt;,
+ os_version: &lt;string&gt;,
+ browser_version: &lt;string&gt;,
+ browser: &lt;string&gt;,
+ device: &lt;string&gt;,
+ status: &lt;string&gt;,
+ hashed_id: &lt;string&gt;,
+ reason: &lt;string&gt;,
+ build_name: &lt;string&gt;,
+ project_name: &lt;string&gt;,
+ logs: &lt;string&gt;,
+ browser_url: &lt;string&gt;,
+ public_url: &lt;string&gt;,
+ video_url: &lt;string&gt;,
+ browser_console_logs_url: &lt;string&gt;,
+ har_logs_url: &lt;string&gt;
+ }
+ },
+ ...
+ ]
+ */
+}
+
+function getSessionDetails(session){
+ var sessionId = session.automation_session.hashed_id;
+ request({uri: baseUrl + "sessions/" + sessionId + ".json"}, function(err, res, body){
+ console.log(JSON.parse(body));
+ });
+ /* Response:
+ {
+ automation_session: {
+ name: &lt;string&gt;,
+ duration: &lt;int&gt;,
+ os: &lt;string&gt;,
+ os_version: &lt;string&gt;,
+ browser_version: &lt;string&gt;,
+ browser: &lt;string&gt;,
+ device: &lt;string&gt;,
+ status: &lt;string&gt;,
+ hashed_id: &lt;string&gt;,
+ reason: &lt;string&gt;,
+ build_name: &lt;string&gt;,
+ project_name: &lt;string&gt;,
+ logs: &lt;string&gt;,
+ browser_url: &lt;string&gt;,
+ public_url: &lt;string&gt;,
+ video_url: &lt;string&gt;,
+ browser_console_logs_url: &lt;string&gt;,
+ har_logs_url: &lt;string&gt;
+ }
+ }
+ */
+}</pre>
+
+<h4 id="Advanced_Automated_tests_2">Advanced: Automated tests</h4>
+
+<p>We'll cover actually running automated BrowserStack tests in the next article.</p>
+
+<h2 id="Summary">Summary</h2>
+
+<p>This was quite a ride, but I'm sure you can start to see the benefit in having automation tools do a lot of the heavy lifting for you in terms of testing.</p>
+
+<p>In the next article, we'll look at setting up our own local automation system using Selenium, and how to combine that with services such as Sauce Labs and BrowserStack</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Feature_detection", "Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+<p> </p>
+
+<h2 id="In_this_module">In this module</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">Introduction to cross browser testing</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">Strategies for carrying out testing</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">Handling common HTML and CSS problems</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">Handling common JavaScript problems</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">Handling common accessibility problems</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">Implementing feature detection</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">Introduction to automated testing</a></li>
+ <li><a href="/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">Setting up your own test automation environment</a></li>
+</ul>
+
+<p> </p>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/feature_detection/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/feature_detection/index.html
new file mode 100644
index 0000000000..1de223efa2
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/feature_detection/index.html
@@ -0,0 +1,357 @@
+---
+title: 機能検出の実装
+slug: Learn/Tools_and_testing/Cross_browser_testing/Feature_detection
+tags:
+ - Article
+ - Beginner
+ - CSS
+ - CodingScripting
+ - JavaScript
+ - Learn
+ - Modernizr
+ - Testing
+ - Tools
+ - cross browser
+ - feature detection
+ - 機能検出
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/Feature_detection
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Accessibility","Learn/Tools_and_testing/Cross_browser_testing/Automated_testing", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">機能検出は、あるブラウザーがあるコードのブロックに対応しているかどうかを調べ、対応しているか (またはしていないか) に応じて異なるコードを実行することで、ブラウザーが常に動作し、ブラウザーによってクラッシュやエラーが発生しないようにします。この記事では、独自の単純な機能検出の書き方、実装をスピードアップするためのライブラリの使い方、 <code>@supports</code> などの機能検出のためのネイティブ機能について詳しく説明します。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td>主要な <a href="/ja/docs/Learn/HTML">HTML</a>、<a href="/ja/docs/Learn/CSS">CSS</a>、および <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語に精通していること。<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">クロスブラウザテストの原則</a>の高水準のアイデア。</td>
+ </tr>
+ <tr>
+ <th scope="row">目標:</th>
+ <td>機能検出の概念について理解し、CSS と JavaScript で適切な解決方法を実装できるようにする。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="The_concept_of_feature_detection" name="The_concept_of_feature_detection">機能検出の概念</h2>
+
+<p>機能検出の根底にあるアイデアは、プログラムを実行中のブラウザーがある特定の機能に対応しているかを確かめ、その結果に応じて異なるコードを実行するということで、対応ブラウザーと非対応ブラウザーのいずれでも許容できる挙動となるようにすることです。もしこの対策をしなければ、その特定の機能に対応していないブラウザーではあなたのサイトが正常に表示されなかったり、エラーを起こしてユーザーの体験を悪化させるでしょう。</p>
+
+<p>それでは、私たちが <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript#Feature_detection">Handling common JavaScript problems</a> で触れた例を振り返ってみましょう。<a href="/ja/docs/Web/API/Geolocation/Using_geolocation">Geolocation API</a> (ブラウザーを実行している端末の位置情報を返します)は、 <a href="/ja/docs/Web/API/Navigator">Navigator</a> オブジェクトに含まれる <code>geolocation</code> プロパティを主なエントリーポイントとして持っています。そこで、以下のようにしてブラウザーが位置情報機能に対応しているかどうかを検出できます。</p>
+
+<pre class="language-js notranslate">if ("geolocation" in navigator) {
+ navigator.geolocation.getCurrentPosition(function(position) {
+ // Google Maps API を用いて現在位置をマップ上に表示します
+ });
+} else {
+ // 位置情報がなくてもマップを表示できるようにします
+}</pre>
+
+<p>しかし、機能検出のためのコードを毎回自分で書くよりも、確立された既存の機能検出ライブラリを使うほうが良いでしょう。この用途では Modernizr が一般に利用されています。Modernizr には後ほど触れます。</p>
+
+<p>次に進む前にもう1つお伝えさせてください。機能検出と<strong>ブラウザー検出</strong>(サイトにアクセスしているブラウザーの種類の検出)を混同しないでください。これはいかなる場合にも避けられるべき悪しき風習です。詳しくは <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript#Using_bad_browser_sniffing_code">Using bad browser sniffing code</a> を参照してください。</p>
+
+<h2 id="Writing_your_own_feature_detection_tests">Writing your own feature detection tests</h2>
+
+<p>In this section, we'll look at implementing your own feature detection tests, in both CSS and JavaScript.</p>
+
+<h3 id="CSS">CSS</h3>
+
+<p>You can write tests for CSS features by testing for the existence of <em><a href="/ja/docs/Web/API/HTMLElement/style">element.style.property</a></em> (e.g. <code>paragraph.style.transform</code>) in JavaScript.</p>
+
+<p>A classic example might be to test for <a href="/ja/docs/Learn/CSS/CSS_layout/Flexbox">Flexbox</a> support in a browser; for browsers that support the newest Flexbox spec, we could use a flexible and robust flex layout. For browsers that don't, we could use a floated layout that works OK, although it is slightly more brittle and hacky, and not as cool-looking.</p>
+
+<p>Let's implement something that demonstrates this, although we'll keep it simple for now.</p>
+
+<ol>
+ <li>Start by making local copies of our <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/css-feature-detect.html">css-feature-detect.html</a></code>, <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/flex-layout.css">flex-layout.css</a></code>, <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/float-layout.css">float-layout-css</a></code>, and <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/basic-styling.css">basic-styling.css</a></code> files. Save them in a new directory.</li>
+ <li>We will add the HTML5 Shiv to our example too so that the HTML5 semantic elements will style properly in older versions of IE. Download the latest version (see <a href="https://github.com/aFarkas/html5shiv#manual-installation">Manual installation</a>), unzip the ZIP file, copy the <code>html5shiv-printshiv.min.js</code> and <code>html5shiv.min.js</code> files into your example directory, and link to one of the files by putting the following under your {{htmlelement("title")}} element:
+ <pre class="notranslate">&lt;script src="html5shiv.min.js"&gt;&lt;/script&gt;</pre>
+ </li>
+ <li>Have a look at your example CSS files — you'll see that <code>basic-styling.css</code> handles all the styling that we want to give to every browser, whereas the other two CSS files contain the CSS we want to selectively apply to browser depending on their support levels. You can look at the different effects these two files they have by manually changing the CSS file referred to by the second {{htmlelement("link")}} element, but let's instead implement some JavaScript to automatically swap them as needed.</li>
+ <li>First, remove the contents of the second <code>&lt;link&gt;</code> element's <code>href</code> attribute. We will fill this in dynamically later on.</li>
+ <li>Next, add a <code>&lt;script&gt;&lt;/script&gt;</code> element at the bottom of your body (just before the closing <code>&lt;/body&gt;</code> tag).</li>
+ <li>Give it the following contents:
+ <pre class="brush: js notranslate">const conditional = document.querySelector('.conditional');
+const testElem = document.createElement('div');
+if (testElem.style.flex !== undefined &amp;&amp; testElem.style.flexFlow !== undefined) {
+ conditional.setAttribute('href', 'flex-layout.css');
+} else {
+ conditional.setAttribute('href', 'float-layout.css');
+}</pre>
+ </li>
+</ol>
+
+<p>Here we are grabbing a reference to the second <code>&lt;link&gt;</code> element, and creating a <code>&lt;div&gt;</code> element as part of our test. In our conditional statement, we test that the {{cssxref("flex")}} and {{cssxref("flex-flow")}} properties exist in the browser. Note how the JavaScript representations of those properties that are stored inside the {{domxref("HTMLElement.style")}} object use lower camel case, not hyphens, to separate the words.</p>
+
+<div class="note">
+<p><strong>Note</strong>: If you have trouble getting this to work, you can compare it to our <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/css-feature-detect-finished.html">css-feature-detect-finished.html</a> code (see also the <a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/feature-detection/css-feature-detect-finished.html">live version</a>).</p>
+</div>
+
+<p>When you save everything and try out your example, you should see the flexbox layout applied to the page if the browser supports modern flexbox, and the float layout if not.</p>
+
+<div class="note">
+<p><strong>Note</strong>: Often such an approach is overkill for a minor feature detection problem — you can often get away with using multiple vendor prefixes and fallback properties, as described in <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#CSS_fallback_behaviour">CSS fallback behavior</a> and <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Handling_CSS_prefixes">Handling CSS prefixes</a>.</p>
+</div>
+
+<h4 id="supports">@supports</h4>
+
+<p>In recent times, CSS has had its own native feature detection mechanism introduced — the {{cssxref("@supports")}} at-rule. This works in a similar manner to <a href="/ja/docs/Web/CSS/Media_Queries">media queries</a> (see also <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Responsive_design_problems">Responsive design problems</a>) — except that instead of selectively applying CSS depending on a media feature like a resolution, screen width or aspect ratio, it selectively applies CSS depending on whether a CSS feature is supported.</p>
+
+<p>For example, we could rewrite our previous example to use <code>@supports</code> — see <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/supports-feature-detect.html">supports-feature-detect.html</a></code> and <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/supports-styling.css">supports-styling.css</a></code>. If you look at the latter, you'll see a couple of <code>@supports</code> blocks, for example:</p>
+
+<pre class="brush: css notranslate">@supports (flex-flow: row) and (flex: 1) {
+
+ main {
+ display: flex;
+ }
+
+ main div {
+ padding-right: 4%;
+ flex: 1;
+ }
+
+ main div:last-child {
+ padding-right: 0;
+ }
+
+}</pre>
+
+<p>This at-rule block applies the CSS rule within only if the current browser supports both the <code>flex-flow: row</code> and <code>flex: 1</code> declarations. For each condition to work, you need to include a complete declaration (not just a property name) and NOT include the semi-colon on the end.</p>
+
+<p><code>@supports</code> also has <code>OR</code> and <code>NOT</code> logic available — the other block applies the float layout if the flexbox properties are not available:</p>
+
+<pre class="brush: css notranslate">@supports not (flex-flow: row) and (flex: 1) {
+
+ /* rules in here */
+
+}</pre>
+
+<p>This may look a lot more convenient than the previous example — we can do all of our feature detection in CSS, no JavaScript required, and we can handle all the logic in a single CSS file, cutting down on HTTP requests. the problem here is browser support — <code>@supports</code> is not supported at all in IE, and only supported in very recent versions of Safari/iOS WebKit (9+/9.2+), whereas the JavaScript version should work in much older browsers (probably back to IE8 or 9, although older versions of IE will have additional problems, such as not supporting {{domxref("Document.querySelector")}}, and having a messed up box model).</p>
+
+<h3 id="JavaScript">JavaScript</h3>
+
+<p>We already saw an example of a JavaScript feature detection test earlier on. Generally, such tests are done via one of the following common patterns:</p>
+
+<table class="standard-table">
+ <caption>Summary of JavaScript feature detection techniques</caption>
+ <thead>
+ <tr>
+ <th scope="col">Feature detection type</th>
+ <th scope="col">Explanation</th>
+ <th scope="col">Example</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><em>If member in object</em></td>
+ <td>Check whether a certain method or property (typically an entry point into using the API or other feature you are detecting for) exists in its parent Object.</td>
+ <td>
+ <p><code>if("geolocation" in navigator) { ... }</code></p>
+ </td>
+ </tr>
+ <tr>
+ <td><em>Property on element</em></td>
+ <td>Create an element in memory using {{domxref("Document.createElement()")}} and then check if a property exists on it. The example shown is a way of detecting <a href="/ja/docs/Web/API/Canvas_API">HTML5 Canvas</a> support.</td>
+ <td><code>function supports_canvas() {<br>
+ return !!document.createElement('canvas').getContext;<br>
+ }<br>
+ <br>
+ if(supports_canvas()) { ... }</code></td>
+ </tr>
+ <tr>
+ <td><em>Method on element return value</em></td>
+ <td>Create an element in memory using {{domxref("Document.createElement()")}} and then check if a method exists on it. If it does, check what value it returns.</td>
+ <td>See <a href="http://diveinto.html5doctor.com/detect.html#video-formats">Dive Into HTML5 Video Formats detection</a> test.</td>
+ </tr>
+ <tr>
+ <td><em>Property on element retains value</em></td>
+ <td>Create an element in memory using {{domxref("Document.createElement()")}}, set a property to a certain value, then check to see if the value is retained.</td>
+ <td>See <a href="http://diveinto.html5doctor.com/detect.html#input-types">Dive into HTML5 <code>&lt;input&gt;</code> types detection</a> test.</td>
+ </tr>
+ </tbody>
+</table>
+
+<div class="note">
+<p><strong>Note</strong>: The double <code>NOT</code> in the above example (<code>!!</code>) is a way to force a return value to become a "proper" boolean value, rather than a {{glossary("Truthy")}}/{{glossary("Falsy")}} value that may skew the results.</p>
+</div>
+
+<p>The <a href="http://diveinto.html5doctor.com/detect.html">Dive into HTML5 Detecting HTML5 Features</a> page has a lot more useful feature detection tests besides the ones listed above, and you can generally find a feature detection test for most things by searching for "detect support for YOUR-FEATURE-HERE" in your favorite search engine. Bear in mind though that some features, however, are known to be undetectable — see Modernizr's list of <a href="https://github.com/Modernizr/Modernizr/wiki/Undetectables">Undetectables</a>.</p>
+
+<h4 id="matchMedia">matchMedia</h4>
+
+<p>We also wanted to mention the {{domxref("Window.matchMedia")}} JavaScript feature at this point too. This is a property that allows you to run media query tests inside JavaScript. It looks like this:</p>
+
+<pre class="brush: js notranslate">if (window.matchMedia("(max-width: 480px)").matches) {
+ // run JavaScript in here.
+}</pre>
+
+<p>As an example, our <a href="https://github.com/chrisdavidmills/snapshot">Snapshot</a> demo makes use of it to selectively apply the Brick JavaScript library and use it to handle the UI layout, but only for the small screen layout (480px wide or less). We first use the <code>media</code> attribute to only apply the Brick CSS to the page if the page width is 480px or less:</p>
+
+<pre class="brush: css notranslate">&lt;link href="dist/brick.css" type="text/css" rel="stylesheet" media="all and (max-width: 480px)"&gt;</pre>
+
+<p>We then use <code>matchMedia()</code> in the JavaScript several times, to only run Brick navigation functions if we are on the small screen layout (in wider screen layouts, everything can be seen at once, so we don't need to navigate between different views).</p>
+
+<pre class="brush: js notranslate">if (window.matchMedia("(max-width: 480px)").matches) {
+ deck.shuffleTo(1);
+}</pre>
+
+<h2 id="Using_Modernizr_to_implement_feature_detection">Using Modernizr to implement feature detection</h2>
+
+<p>It is possible to implement your own feature detection tests using techniques like the ones detailed above. You might as well use a dedicated feature detection library however, as it makes things much easier. The mother of all feature detection libraries is <a href="https://modernizr.com/">Modernizr</a>, and it can detect just about everything you'll ever need. Let's look at how to use it now.</p>
+
+<p>When you are experimenting with Modernizr you might as well use the development build, which includes every possible feature detection test. Download this now by:</p>
+
+<ol>
+ <li>Clicking on the <a href="https://modernizr.com/download?do_not_use_in_production">Development build</a> link.</li>
+ <li>Clicking the big pink <em>Build</em> button on the page that comes up.</li>
+ <li>Clicking the top <em>Download</em> link in the dialog box that appears.</li>
+</ol>
+
+<p>Save it somewhere sensible, like the directory you've been creating your other examples for in this article.</p>
+
+<p>When you are using Modernizr in production, you can go to the <a href="https://modernizr.com/download">Download page</a> you've already visited and click the plus buttons for only the features you need feature detects for. Then when you click the <em>Build</em> button, you'll download a custom build containing only those feature detects, making for a much smaller file size.</p>
+
+<h3 id="CSS_2">CSS</h3>
+
+<p>Let's have a look at how Modernizr works in terms of selectively applying CSS.</p>
+
+<ol>
+ <li>First, make a copy of <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/supports-feature-detect.html">supports-feature-detect.html</a></code> and <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/supports-styling.css">supports-styling.css</a></code>. Save them as <code>modernizr-css.html</code> and <code>modernizr-css.css</code>.</li>
+ <li>Update your {{htmlelement("link")}} element in your HTML so it points to the correct CSS file (you should also update your {{htmlelement("title")}} element to something more suitable!):
+ <pre class="brush: html notranslate">&lt;link href="modernizr-css.css" rel="stylesheet"&gt;</pre>
+ </li>
+ <li>Above this <code>&lt;link&gt;</code> element, add a {{htmlelement("script")}} element to apply the Modernizr library to the page, as shown below. This needs to be applied to the page before any CSS (or JavaScript) that might make use of it.
+ <pre class="brush: html notranslate">&lt;script src="modernizr-custom.js"&gt;&lt;/script&gt;</pre>
+ </li>
+ <li>Now edit your opening <code>&lt;html&gt;</code> tag, so that it looks like this:
+ <pre class="brush: html notranslate">&lt;html class="no-js"&gt;</pre>
+ </li>
+</ol>
+
+<p>At this point, try loading your page, and you'll get an idea of how Modernizr works for CSS features. If you look at the DOM inspector of your browser's developer tools, you'll see that Modernizr has updated your <code>&lt;html&gt;</code> <code>class</code> value like so:</p>
+
+<pre class="notranslate">&lt;html class="js no-htmlimports sizes flash transferables applicationcache blobconstructor
+blob-constructor cookies cors ...AND LOADS MORE VALUES!&gt;</pre>
+
+<p>It now contains a large number of classes that indicate the support status of different technology features. As an example, if the browser didn't support flexbox at all, <code>&lt;html&gt;</code> would be given a class name of <code>no-flexbox</code>. If it did support modern flexbox, it would get a class name of <code>flexbox</code>. If you search through the class list, you'll also see others relating to flexbox, like:</p>
+
+<ul>
+ <li><code>flexboxlegacy</code> for the old flexbox spec (2009).</li>
+ <li><code>flexboxtweener</code> for 2011 in between syntax supported by IE10.</li>
+ <li><code>flexwrap</code> for the {{cssxref("flex-wrap")}} property, which isn't present in some implementations.</li>
+</ul>
+
+<div class="note">
+<p><strong>Note</strong>: You can find a list of what all the class names mean — see <a href="https://modernizr.com/docs#features">Features detected by Modernizr</a>.</p>
+</div>
+
+<p>Moving on, let's update our CSS to use Modernizr rather than <code>@supports</code>. Go into <code>modernizr-css.css</code>, and replace the two <code>@supports</code> blocks with the following:</p>
+
+<pre class="brush: css notranslate">/* Properties for browsers with modern flexbox */
+
+.flexbox main {
+ display: flex;
+}
+
+.flexbox main div {
+ padding-right: 4%;
+ flex: 1;
+}
+
+.flexbox main div:last-child {
+ padding-right: 0;
+}
+
+/* Fallbacks for browsers that don't support modern flexbox */
+
+.no-flexbox main div {
+ width: 22%;
+ float: left;
+ padding-right: 4%;
+}
+
+.no-flexbox main div:last-child {
+ padding-right: 0;
+}
+
+.no-flexbox footer {
+ clear: left;
+}</pre>
+
+<p>So how does this work? Because all those class names have been put on the <code>&lt;html&gt;</code> element, you can target browsers that do or don't support a feature using specific descendant selectors. So here we're applying the top set of rules only to browsers that do support flexbox, and the bottom set of rules only to browsers that don't (<code>no-flexbox</code>).</p>
+
+<div class="note">
+<p><strong>Note</strong>: Bear in mind that all of Modernizr's HTML and JavaScript feature tests are also reported in these class names, so you can quite happily apply CSS selectively based on whether the browser supports HTML or JavaScript features, if needed.</p>
+</div>
+
+<div class="note">
+<p><strong>Note</strong>: If you have trouble getting this to work, check your code against our <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/modernizr-css.html">modernizr-css.html</a></code> and <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/modernizr-css.css">modernizr-css.css</a></code> files (see this running live also).</p>
+</div>
+
+<h3 id="JavaScript_2">JavaScript</h3>
+
+<p>Modernizr is also equally well-prepared for implementing JavaScript feature detects too. It does this by making the global <code>Modernizr</code> object available to the page it is applied to, which contains results of the feature detects as <code>true</code>/<code>false</code> properties.</p>
+
+<p>For example, load up our <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/modernizr-css.html">modernizr-css.html</a></code> example in your browser, then try going to your JavaScript console and typing in <code>Modernizr.</code> followed by some of those class names (they are the same here too). For example:</p>
+
+<pre class="notranslate">Modernizr.flexbox
+Modernizr.websqldatabase
+Modernizr.xhr2
+Modernizr.fetch</pre>
+
+<p>The console will return <code>true</code>/<code>false</code> values to indicate whether your browser supports those features or not.</p>
+
+<p>Let's look at an example to show how you'd use those properties.</p>
+
+<ol>
+ <li>First of all, make a local copy of the <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/feature-detection/modernizr-js.html">modernizr-js.html</a></code> example file.</li>
+ <li>Attach the Modernizr library to the HTML using a <code>&lt;script&gt;</code> element, as we have done in previous demos. Put it above the existing <code>&lt;script&gt;</code> element, which is attaching the Google Maps API to the page.</li>
+ <li>Next, fill in the <code>YOUR-API-KEY</code> placeholder text in the second <code>&lt;script&gt;</code> element (as it is now) with a valid Google Maps API key. To get a key, sign in to a Google account, go to the <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Get a Key/Authentication</a> page, then click the blue <em>Get a Key</em> button and follow the instructions.</li>
+ <li>Finally, add another <code>&lt;script&gt;</code> element at the bottom of the HTML body (just before the <code>&lt;/body&gt;</code> tag), and put the following script inside the tags:
+ <pre class="brush: js notranslate">if (Modernizr.geolocation) {
+
+ navigator.geolocation.getCurrentPosition(function(position) {
+
+ let latlng = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
+ let myOptions = {
+ zoom: 8,
+ center: latlng,
+ mapTypeId: google.maps.MapTypeId.TERRAIN,
+ disableDefaultUI: true
+ }
+ let map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
+ });
+
+} else {
+ const para = document.createElement('p');
+ para.textContent = 'Argh, no geolocation!';
+ document.body.appendChild(para);
+}</pre>
+ </li>
+</ol>
+
+<p>Try your example out! Here we use the <code>Modernizr.geolocation</code> test to check whether geolocation is supported by the current browser. If it is, we run some code that gets your device's current location, and plots it on a Google Map.</p>
+
+<h2 id="Summary">Summary</h2>
+
+<p>This article covered feature detection in a reasonable amount of detail, going through the main concepts and showing you how to both implement your own feature detection tests and use the Modernizr library to implement tests more easily.</p>
+
+<p>Next up, we'll start looking at automated testing.</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Accessibility","Learn/Tools_and_testing/Cross_browser_testing/Automated_testing", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+<h2 id="In_this_module">In this module</h2>
+
+<ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">Introduction to cross browser testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">Strategies for carrying out testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">Handling common HTML and CSS problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">Handling common JavaScript problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">Handling common accessibility problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">Implementing feature detection</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">Introduction to automated testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">Setting up your own test automation environment</a></li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/html_and_css/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/html_and_css/index.html
new file mode 100644
index 0000000000..62e21f35a2
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/html_and_css/index.html
@@ -0,0 +1,508 @@
+---
+title: 一般的な HTML と CSS の問題への対処
+slug: Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS
+tags:
+ - CSS
+ - CodingScripting
+ - HTML
+ - linting
+ - クロスブラウザ
+ - セレクタ
+ - テスト
+ - 初心者
+ - 学習
+ - 記事
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies","Learn/Tools_and_testing/Cross_browser_testing/JavaScript", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">ここでは、HTML と CSS のコードで発生する可能性のある一般的なクロスブラウザの問題、および問題の発生を防ぐため、または発生する問題を修正するために使用できるツールについて具体的に説明します。これには、コードのリンティング、CSS プレフィックスの処理、問題を追跡するためのブラウザの開発者ツールの使用、ブラウザにサポートを追加するための polyfill の使用、レスポンシブデザイン問題への取り組みなどが含まれます。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td>主要な <a href="/ja/docs/Learn/HTML">HTML</a>、<a href="/ja/docs/Learn/CSS">CSS</a>、および <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語に精通していること。<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">クロスブラウザテストの原則</a>の高水準のアイデア。</td>
+ </tr>
+ <tr>
+ <th scope="row">目標:</th>
+ <td>一般的な HTML と CSS のクロスブラウザの問題を診断し、それらを修正するための適切なツールとテクニックを使うことができるようにする。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="HTML_と_CSS_の問題">HTML と CSS の問題</h2>
+
+<p>一部の HTML と CSS の問題<span class="tlid-translation translation" lang="ja"><span title="">は、両方の言語がかなり単純で、コードがうまく作成され、効率的であり、ページ上に「機能の目的」を意味的に記述していることを確認するという意味で開発者がそれらについて真剣に考えていないという事実にあります。</span></span>最悪の場合、JavaScript を使用して Web ページのコンテンツとスタイル全体を生成するため、ページにアクセスできなくなり、パフォーマンスが低下します (DOM 要素の生成にはコストがかかります)。他のケースでは、初期の機能がブラウザ間で一貫してサポートされていないため、一部の機能やスタイルが一部のユーザには機能しないことがあります。<br>
+ レスポンシブデザインの問題も一般的です。デスクトップブラウザで見栄えの良いサイトはモバイル端末だとひどい経験を提供するかもしれません、内容が読むには小さすぎるか、高精細なアニメーションのせいで遅いでしょう。</p>
+
+<p>HTML/CSS に起因するクロスブラウザエラーを減らす方法を見てみましょう。</p>
+
+<h2 id="まず最初に:一般的な問題を解決する">まず最初に:一般的な問題を解決する</h2>
+
+<p><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction#Testingdiscovery">このシリーズの最初の記事</a>では、まずクロスブラウザの問題に集中する前に、デスクトップ/モバイルの最新ブラウザでいくつかテストしてコードが正常に機能するか確認することをお勧めします。</p>
+
+<p><a href="/ja/docs/Learn/HTML/Introduction_to_HTML/Debugging_HTML">HTML のデバッグ</a>および <a href="/ja/docs/Learn/CSS/Introduction_to_CSS/Debugging_CSS">CSS のデバッグ</a>の記事では、HTML/CSS のデバッグに関する基本的なガイダンスをいくつか提供しました。基本に慣れていない場合は、先に進む前に必ずこれらの記事をよく読んでください。</p>
+
+<p>基本的には、HTML と CSS のコードが整形式で、構文エラーがないかどうかをチェックすることです。</p>
+
+<div class="note">
+<p><strong>メモ</strong>: CSS と HTML に関する一般的な問題の1つは、異なる CSS ルールが互いに矛盾が生じるときに発生します。 サードパーティのコードを使用している場合、これは特に問題になる可能性があります。たとえば、CSS フレームワークを使用して、それが使用しているクラス名の1つが別の目的ですでに使用されているものと衝突しているとします。 または、ある種のサードパーティ API (たとえば広告バナーの生成) によって生成された HTML に、すでに別の目的で使用されているクラス名または ID が含まれていることもあります。これが起こらないようにするには、最初に使用しているツールを調べて、それらを中心にコードを設計する必要があります。また、"名前空間"  CSS も価値があります。ウィジェットがある場合は、それが明確なクラスを持っていることを確認してから、このクラスでウィジェット内の要素を選択するセレクタを起動します。そうすれば競合は起こりにくくなります。例えば、 <code>.audio-player ul a</code> です。</p>
+</div>
+
+<h3 id="検証">検証</h3>
+
+<p>HTML の検証では、すべてのタグが適切に閉じられてネストされていること、DOCTYPE を使用していること、およびタグを正しい目的で使用していることを確認します。良い戦略はコードを定期的に検証することです。これを可能にするサービスの 1 つに、W3C <a href="https://validator.w3.org/">マークアップ検証サービス</a>があります。これを使用すると、コードを指定してエラーのリストを返すことができます。</p>
+
+<p><img alt="The HTML validator homepage" src="https://mdn.mozillademos.org/files/12441/validator.png" style="display: block; margin: 0px auto;"></p>
+
+<p>CSS にも同様の話があります — プロパティ名が正しくつづられていること、プロパティ値が正しくつづられていて、それらが使われているプロパティに対して有効であること、中括弧を見逃していないということです。この目的のために、W3C には <a href="http://jigsaw.w3.org/css-validator/">CSS Validator</a> も用意されています。</p>
+
+<h3 id="Linters">Linters</h3>
+
+<p>取りうるもう一つの良い選択肢は、エラーを指摘するだけでなく、CSS の悪いプラクティスについての警告、および他の点にもフラグを立てることができる、いわゆる Linter アプリケーションです。Linter は一般的に、エラー/警告の報告においてより厳格またはより緩やかになるようにカスタマイズできます。</p>
+
+<p>オンラインリンターアプリケーションは多数ありますが、そのうち最良のものはおそらく <a href="https://www.dirtymarkup.com/">Dirty Markup</a> (HTML、CSS、JavaScript)、および <a href="http://csslint.net/">CSS Lint</a> (CSS のみ) です。これらはコードをウィンドウに貼り付けることができ、十字でどんなエラーにでもフラグを立てるでしょう、そしてそれは問題が何であるかを知らせるエラーメッセージを得るためにそれから隠されることができます。Dirty Markup では、<em>Clean</em> ボタンを使用してマークアップを修正することもできます。</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14113/dirty-markup.png" style="border-style: solid; border-width: 1px; display: block; height: 203px; margin: 0px auto; width: 1204px;"></p>
+
+<p>However, it is not very convenient to have to copy and paste your code over to a web page to check its validity several times. What you really want is a linter that will fit into your standard workflow with the minimum of hassle.</p>
+
+<p>Many code editors have linter plugins. Github's <a href="https://atom.io/">Atom</a> code editor for example has a rich plugin ecosystem available, with many linting options. To show you an example of how such plugins generally work:</p>
+
+<ol>
+ <li>Install Atom (if you haven't got an up-to-date version already installed) — download it from the Atom page linked above.</li>
+ <li>Go to Atom's <em>Preferences...</em> dialog (e.g. by Choosing <em>Atom &gt; Preferences...</em> on Mac, or <em>File &gt; Preferences...</em> on Windows/Linux) and choose the <em>Install</em> option in the left hand menu.</li>
+ <li>In the <em>Search packages</em> text field, type "lint" and press Enter/Return to search for linting-related packages.</li>
+ <li>You should see a package called <strong>lint</strong> at the top of the list. Install this first (using the <em>Install</em> button), as other linters rely on it to work. After that, install the <strong>linter-csslint</strong> plugin for linting CSS, and the <strong>linter-tidy</strong> plugin for linting HTML.</li>
+ <li>After the packages have finished installing, try loading up an HTML file and a CSS file: you'll see any issues highlighted with green (for warnings) and red (for errors) circles next to the line numbers, and a separate panel at the bottom provides line numbers, error messages, and sometimes suggested values or other fixes.</li>
+</ol>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14109/atom-htmltidy.png" style="display: block; margin: 0 auto;"><img alt="" src="https://mdn.mozillademos.org/files/14107/atom-csslint.png" style="display: block; height: 516px; margin: 0px auto; width: 700px;"></p>
+
+<p>Other popular editors have similar linting packages available. For example, see:</p>
+
+<ul>
+ <li><a href="https://developer.mozilla.org/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/www.sublimelinter.com/">SublimeLinter</a> for Sublime Text</li>
+ <li><a href="https://sourceforge.net/projects/notepad-linter/">Notepad++ linter</a></li>
+</ul>
+
+<h3 id="Browser_developer_tools">Browser developer tools</h3>
+
+<p>The developer tools built into most browsers also feature useful tools for hunting down errors, mainly for CSS.</p>
+
+<div class="note">
+<p><strong>メモ</strong>: ブラウザが不正な形式のマークアップを自動的に修正しようとするため、HTML エラーは開発ツールではそれほど簡単には表示されない傾向があります。W3C バリデータは HTML エラーを取得するための最良の方法です — 上の {{anch("Validation")}} を見てください。</p>
+</div>
+
+<p>As an example, in Firefox the CSS inspector will show CSS declarations that aren't applied crossed out, with a warning triangle. Hovering the warning triangle will provide a descriptive error message:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14111/css-message-devtools.png" style="display: block; height: 311px; margin: 0px auto; width: 451px;"></p>
+
+<p>Other browser devtools have similar features.</p>
+
+<h2 id="Common_cross_browser_problems">Common cross browser problems</h2>
+
+<p>Now let's move on to look at some of the most common cross browser HTML and CSS problems. The main areas we'll look at are lack of support for modern features, and layout issues.</p>
+
+<h3 id="Older_browsers_not_supporting_modern_features">Older browsers not supporting modern features</h3>
+
+<p>This is a common problem, especially when you need to support old browsers (such as old IE versions) or you are using features that are implemented using CSS prefixes. In general, most core HTML and CSS functionality (such as basic HTML elements, CSS basic colors and text styling) works across most browsers you'll want to support; more problems are uncovered when you start wanting to use newer features such as <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox">Flexbox</a>, or <a href="https://developer.mozilla.org/en-US/docs/Web/Apps/Fundamentals/Audio_and_video_delivery">HTML5 video/audio</a>, or even more nascent, <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids#Native_CSS_Grids_with_Grid_Layout">CSS Grids</a> or <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_boxes/Advanced_box_effects#-webkit-background-clip_text">-webkit-background-clip: text</a>.</p>
+
+<p>Once you've identified a list of potential problem technologies you will be using, it is a good idea to research what browsers they are supported in, and what related techniques are useful. See {{anch("Finding help")}} below.</p>
+
+<h4 id="HTML_fallback_behaviour">HTML fallback behaviour</h4>
+
+<p>Some problems can be solved by just taking advantage of the natural way in which HTML/CSS work.</p>
+
+<p>Unrecognised HTML elements are treated by the browser as anonymous inline elements (effectively inline elements with no semantic value, similar to {{htmlelement("span")}} elements). You can still refer to them by their names, and style them with CSS, for example — you just need to make sure they are behaving as you want them to, for example setting <code>display: block;</code> on all of the new semantic elements (such as {{htmlelement("article")}}, {{htmlelement("aside")}}, etc.), but only in old versions of IE that don't recognise them (so, IE 8 and lower). This way new browsers can just use the code as normal, but older IE versions will be able to style these elements too.</p>
+
+<div class="note">
+<p><strong>Note</strong>: See {{anch("IE conditional comments")}} for the best way to do this.</p>
+</div>
+
+<p>More complex elements like HTML <code><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video">&lt;video&gt;</a></code>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio">&lt;audio&gt;</a></code>, and <code><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas">&lt;canvas&gt;</a></code> (and other features besides) have natural mechanisms for fallbacks to be added, which work on the same principle as described above. You can add fallback content in between the opening and closing tags, and non-supporting browsers will effectively ignore the outer element and run the nested content.</p>
+
+<p>For example:</p>
+
+<pre class="brush: html language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>video</span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video<span class="punctuation token">"</span></span> <span class="attr-name token">controls</span> <span class="attr-name token">preload</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>metadata<span class="punctuation token">"</span></span> <span class="attr-name token">poster</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>img/poster.jpg<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>source</span> <span class="attr-name token">src</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video/tears-of-steel-battle-clip-medium.mp4<span class="punctuation token">"</span></span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video/mp4<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>source</span> <span class="attr-name token">src</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video/tears-of-steel-battle-clip-medium.webm<span class="punctuation token">"</span></span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video/webm<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>source</span> <span class="attr-name token">src</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video/tears-of-steel-battle-clip-medium.ogg<span class="punctuation token">"</span></span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video/ogg<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="comment token">&lt;!-- Flash fallback --&gt;</span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>object</span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>application/x-shockwave-flash<span class="punctuation token">"</span></span> <span class="attr-name token">data</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>flash-player.swf?videoUrl=video/tears-of-steel-battle-clip-medium.mp4<span class="punctuation token">"</span></span> <span class="attr-name token">width</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>1024<span class="punctuation token">"</span></span> <span class="attr-name token">height</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>576<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>param</span> <span class="attr-name token">name</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>movie<span class="punctuation token">"</span></span> <span class="attr-name token">value</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>flash-player.swf?videoUrl=video/tears-of-steel-battle-clip-medium.mp4<span class="punctuation token">"</span></span> <span class="punctuation token">/&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>param</span> <span class="attr-name token">name</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>allowfullscreen<span class="punctuation token">"</span></span> <span class="attr-name token">value</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>true<span class="punctuation token">"</span></span> <span class="punctuation token">/&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>param</span> <span class="attr-name token">name</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>wmode<span class="punctuation token">"</span></span> <span class="attr-name token">value</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>transparent<span class="punctuation token">"</span></span> <span class="punctuation token">/&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>param</span> <span class="attr-name token">name</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>flashvars<span class="punctuation token">"</span></span> <span class="attr-name token">value</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>controlbar=over<span class="entity token" title="&amp;">&amp;amp;</span>image=img/poster.jpg<span class="entity token" title="&amp;">&amp;amp;</span>file=flash-player.swf?videoUrl=video/tears-of-steel-battle-clip-medium.mp4<span class="punctuation token">"</span></span> <span class="punctuation token">/&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>img</span> <span class="attr-name token">alt</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>Tears of Steel poster image<span class="punctuation token">"</span></span> <span class="attr-name token">src</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>img/poster.jpg<span class="punctuation token">"</span></span> <span class="attr-name token">width</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>1024<span class="punctuation token">"</span></span> <span class="attr-name token">height</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>428<span class="punctuation token">"</span></span> <span class="attr-name token">title</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>No video playback possible, please download the video from the link below<span class="punctuation token">"</span></span> <span class="punctuation token">/&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>object</span><span class="punctuation token">&gt;</span></span>
+ <span class="comment token">&lt;!-- Offer download --&gt;</span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>a</span> <span class="attr-name token">href</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>video/tears-of-steel-battle-clip-medium.mp4<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>Download MP4<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>a</span><span class="punctuation token">&gt;</span></span>
+<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>video</span><span class="punctuation token">&gt;</span></span></code></pre>
+
+<p>This example (taken from <a href="https://developer.mozilla.org/en-US/docs/Web/Apps/Fundamentals/Audio_and_video_delivery/cross_browser_video_player">Creating a cross-browser video player</a>) includes not only a Flash video fallback for older IE versions, but also a simple link allowing you to download the video if even the Flash player doesn't work, so at least the user can still access the video.</p>
+
+<div class="note">
+<p><strong>Note</strong>: 3rd party libraries like <a href="http://videojs.com/">Video.js</a> and <a href="https://www.jwplayer.com/">JW Player</a> use such fallback mechanisms to provide cross-browser support.</p>
+</div>
+
+<p>HTML5 form elements also exhibit fallback qualities — HTML5 introduced some special <code><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">&lt;input&gt;</a></code> types for inputting specific information into forms, such as times, dates, colors, numbers, etc. These are very useful, particularly on mobile platforms, where providing a pain-free way of entering data is very important for the user experience. Supporting platforms provide special UI widgets when these input types are used, such as a calendar widget for entering dates.</p>
+
+<p>The following example shows date and time inputs:</p>
+
+<pre class="brush: html line-numbers language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>form</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>div</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>label</span> <span class="attr-name token">for</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>date<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>Enter a date:<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>label</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>input</span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>date<span class="punctuation token">"</span></span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>date<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>div</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>div</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>label</span> <span class="attr-name token">for</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>time<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>Enter a time:<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>label</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>input</span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>time<span class="punctuation token">"</span></span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>time<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>div</span><span class="punctuation token">&gt;</span></span>
+<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>form</span><span class="punctuation token">&gt;</span></span></code></pre>
+
+<p>The output of this code is as follows:</p>
+
+<div class="hidden">
+<h6 id="Hidden_example">Hidden example</h6>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css"><span class="selector token">label</span> <span class="punctuation token">{</span>
+ <span class="property token">float</span><span class="punctuation token">:</span> left<span class="punctuation token">;</span>
+ <span class="property token">width</span><span class="punctuation token">:</span> <span class="number token">30</span><span class="token unit">%</span><span class="punctuation token">;</span>
+ <span class="property token">text-align</span><span class="punctuation token">:</span> right<span class="punctuation token">;</span>
+ <span class="punctuation token">}</span>
+
+ <span class="selector token">input</span> <span class="punctuation token">{</span>
+ <span class="property token">float</span><span class="punctuation token">:</span> right<span class="punctuation token">;</span>
+ <span class="property token">width</span><span class="punctuation token">:</span> <span class="number token">65</span><span class="token unit">%</span><span class="punctuation token">;</span>
+ <span class="punctuation token">}</span>
+
+ <span class="selector token">label, input</span> <span class="punctuation token">{</span>
+ <span class="property token">margin-bottom</span><span class="punctuation token">:</span> <span class="number token">20</span><span class="token unit">px</span><span class="punctuation token">;</span>
+ <span class="punctuation token">}</span>
+
+ <span class="selector token">div</span> <span class="punctuation token">{</span>
+ <span class="property token">clear</span><span class="punctuation token">:</span> both<span class="punctuation token">;</span>
+ <span class="property token">margin</span><span class="punctuation token">:</span> <span class="number token">10</span><span class="token unit">px</span><span class="punctuation token">;</span>
+ <span class="punctuation token">}</span>
+
+ <span class="selector token">body</span> <span class="punctuation token">{</span>
+ <span class="property token">width</span><span class="punctuation token">:</span> <span class="number token">400</span><span class="token unit">px</span><span class="punctuation token">;</span>
+ <span class="property token">margin</span><span class="punctuation token">:</span> <span class="number token">0</span> auto<span class="punctuation token">;</span>
+ <span class="punctuation token">}</span></code></pre>
+</div>
+
+<p> </p>
+
+<pre class="brush: html line-numbers language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>form</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>div</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>label</span> <span class="attr-name token">for</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>date<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>Enter a date:<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>label</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>input</span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>date<span class="punctuation token">"</span></span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>date<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>div</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>div</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>label</span> <span class="attr-name token">for</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>time<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>Enter a time:<span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>label</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>input</span> <span class="attr-name token">id</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>time<span class="punctuation token">"</span></span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>time<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>div</span><span class="punctuation token">&gt;</span></span>
+ <span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>form</span><span class="punctuation token">&gt;</span></span></code></pre>
+
+<div class="hidden"> </div>
+
+<p>{{ EmbedLiveSample('Hidden_example', '100%', 150) }}</p>
+
+<div class="note">
+<p><strong>Note</strong>: You can also see this running live as <a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/html-css/forms-test.html">forms-test.html</a> on GitHub (see the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/html-css/forms-test.html">source code</a> also).</p>
+</div>
+
+<p>If you view the example on a supporting browser like desktop/Android Chrome or iOS Safari, you'll see the special widgets/features in action as you try to input data. On a non-supporting platform such as Firefox or Internet Explorer, the inputs will just fallback to normal text inputs, so at least the user can still enter some information.</p>
+
+<p>Note: Of course, this may not be a great solution for your project's needs — the difference in visual presentation is not great, plus it is harder to guarantee the data will be entered in the format you want it in. For cross browser forms, It is probably better to rely on simple form elements, or selectively using advanced form elements only in supporting browsers, or using a library that provides decent cross browser form widgets, such as <a href="http://jqueryui.com/">jQuery UI</a> or <a href="https://bootstrap-datepicker.readthedocs.io/en/latest/">Bootstrap datepicker</a>.</p>
+
+<h4 id="CSS_fallback_behaviour">CSS fallback behaviour</h4>
+
+<p>CSS is arguably better at fallbacks than HTML. If a browser encounters a declaration or rule it doesn't understand, it just skips it completely without applying it or throwing an error. This might be frustrating for you and your users if such a mistake slips through to production code, but at least it means the whole site doesn't come crashing down because of one error, and if used cleverly you can use it to your advantage.</p>
+
+<p>Let's look at an example — a simple box styled with CSS, which has some styling provided by various CSS3 features:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14141/blingy-button.png" style="display: block; margin: 0 auto;"></p>
+
+<div class="note">
+<p><strong>Note</strong>: You can also see this example running live on GitHub as <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/html-css/button-with-fallback.html">button-with-fallback.html</a> (also see the <a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/html-css/button-with-fallback.html">source code</a>).</p>
+</div>
+
+<p>The button has a number of declarations that style, but the two we are most interested in are as follows:</p>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css"><span class="selector token">button</span> <span class="punctuation token">{</span>
+ <span class="number token">...</span>
+
+ <span class="property token">background-color</span><span class="punctuation token">:</span> <span class="hexcode token">#ff0000</span><span class="punctuation token">;</span>
+ <span class="property token">background-color</span><span class="punctuation token">:</span> <span class="function token">rgba</span><span class="punctuation token">(</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">1</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+ <span class="property token">box-shadow</span><span class="punctuation token">:</span> inset <span class="number token">1</span><span class="token unit">px</span> <span class="number token">1</span><span class="token unit">px</span> <span class="number token">3</span><span class="token unit">px</span> <span class="function token">rgba</span><span class="punctuation token">(</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">0.4</span><span class="punctuation token">)</span><span class="punctuation token">,</span>
+ inset <span class="number token">-1</span><span class="token unit">px</span> <span class="number token">-1</span><span class="token unit">px</span> <span class="number token">3</span><span class="token unit">px</span> <span class="function token">rgba</span><span class="punctuation token">(</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0.4</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="punctuation token">}</span>
+
+<span class="selector token">button<span class="pseudo-class token">:hover</span></span> <span class="punctuation token">{</span>
+ <span class="property token">background-color</span><span class="punctuation token">:</span> <span class="function token">rgba</span><span class="punctuation token">(</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0.5</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="punctuation token">}</span>
+
+<span class="selector token">button<span class="pseudo-class token">:active</span></span> <span class="punctuation token">{</span>
+ <span class="property token">box-shadow</span><span class="punctuation token">:</span> inset <span class="number token">1</span><span class="token unit">px</span> <span class="number token">1</span><span class="token unit">px</span> <span class="number token">3</span><span class="token unit">px</span> <span class="function token">rgba</span><span class="punctuation token">(</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0</span><span class="punctuation token">,</span><span class="number token">0.4</span><span class="punctuation token">)</span><span class="punctuation token">,</span>
+ inset <span class="number token">-1</span><span class="token unit">px</span> <span class="number token">-1</span><span class="token unit">px</span> <span class="number token">3</span><span class="token unit">px</span> <span class="function token">rgba</span><span class="punctuation token">(</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">255</span><span class="punctuation token">,</span><span class="number token">0.4</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="punctuation token">}</span></code></pre>
+
+<p>Here we are providing an <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#rgba()">RGBA</a> {{cssxref("background-color")}} that changes opacity on hover to give the user a hint that the button is interactive, and some semi-transparent inset {{cssxref("box-shadow")}} shades to give the button a bit of texture and depth. The trouble is that RGBA colors and box shadows don't work in IE versions older than 9 — in older versions the background just wouldn't show up at all so the text would be unreadable, no good at all!</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14135/unreadable-button.png" style="display: block; margin: 0 auto;"></p>
+
+<p>To sort this out, we have added a second <code>background-color</code> declaration, which just specifies a hex color — this is supported way back in really old browsers, and acts as a fallback if the modern shiny features don't work. What happens is a browser visiting this page first applies the first <code>background-color</code> value; when it gets to the second <code>background-color</code> declaration, it will override the initial value with this value if it supports RGBA colors. If not, it will just ignore the entire declaration and move on.</p>
+
+<div class="note">
+<p><strong>Note</strong>: The same is true for other CSS features like <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries">media queries</a>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face">@font-face</a></code> and <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@supports">@supports</a></code> blocks — if they are not supported, the browser just ignores them.</p>
+</div>
+
+<h4 id="IE_conditional_comments">IE conditional comments</h4>
+
+<p>IE conditional comments are a modified proprietary HTML comment syntax, which can be used to selectively apply HTML code to different versions of IE. This has proven to be a very effective mechanism for fixing cross browser bugs. The syntax looks like this:</p>
+
+<pre class="brush: html line-numbers language-html"><code class="language-html"><span class="comment token">&lt;!--[if lte IE 8]&gt;
+ &lt;script src="ie-fix.js"&gt;&lt;/script&gt;
+ &lt;link href="ie-fix.css" rel="stylesheet" type="text/css"&gt;
+&lt;![endif]--&gt;</span></code></pre>
+
+<p>This block will apply the IE-specific CSS and JavaScript only if the browser viewing the page is IE 8 or older. <code>lte</code> means "less than or equal to", but you can also use lt, gt, gte, <code>!</code> for NOT, and other logical syntax.</p>
+
+<div class="note">
+<p><strong>Note</strong>: Sitepoint's <span class="l-d-i l-pa2 t-bg-white"><a href="https://www.sitepoint.com/web-foundations/internet-explorer-conditional-comments/">Internet Explorer Conditional Comments</a> provides a useful beginner's tutorial/reference that explains the conditional comment syntax in detail.</span></p>
+</div>
+
+<p>As you can see, this is especially useful for applying code fixes to old versions of IE. The use case we mentioned earlier (making modern semantic elements styleable in old versions of IE) can be achieved easily using conditional comments, for example you could put something like this in your IE stylesheet:</p>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css"><span class="selector token">aside, main, article, section, nav, figure, figcaption</span> <span class="punctuation token">{</span>
+ <span class="property token">display</span><span class="punctuation token">:</span> block<span class="punctuation token">;</span>
+<span class="punctuation token">}</span></code></pre>
+
+<p>It isn't that simple, however — you also need to create a copy of each element you want to style in the DOM via JavaScript, for them to be styleable; this is a strange quirk, and we won't bore you with the details here. For example:</p>
+
+<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">var</span> asideElem <span class="operator token">=</span> document<span class="punctuation token">.</span><span class="function token">createElement</span><span class="punctuation token">(</span><span class="string token">'aside'</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+ <span class="operator token">...</span></code></pre>
+
+<p>This sounds like a pain to deal with, but fortunately there is a {{glossary("polyfill")}} available that does the necessary fixes for you, and more besides — see <a href="https://github.com/aFarkas/html5shiv">HTML5Shiv</a> for all the details (see <a href="https://github.com/aFarkas/html5shiv#installation">manual installation</a> for the simplest usage).</p>
+
+<h4 id="Selector_support">Selector support</h4>
+
+<p>Of course, no CSS features will apply at all if you don't use the right <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Selectors">selectors</a> to select the element you want to style! If you just write a selector incorrectly so the styling isn't as expected in any browser, you'll just need to troubleshoot and work out what is wrong with your selector. We find that it is helpful to inspect the element you are trying to style using your browser's dev tools, then look at the DOM tree breadcrumb trail that DOM inspectors tend to provide to see if your selector makes sense compared to it.</p>
+
+<p>For example, in the Firefox dev tools, you get this kind of output at the bottom of the DOM inspector:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14139/dom-breadcrumb-trail.png" style="display: block; height: 24px; margin: 0px auto; width: 448px;"></p>
+
+<p>If for example you were trying to use this selector, you'd be able to see that it wouldn't select the input element as desired:</p>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css">form &gt; #date</code></pre>
+
+<p>(The <code>date</code> form input isn't directly inside the <code>&lt;form&gt;</code>; you'd be better off using a general descendant selector instead of a child selector).</p>
+
+<p>However, another issue that appears in versions of IE older than 9 is that none of the newer selectors (mainly pseudo-classes and pseudo-elements like <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type">:nth-of-type</a></code>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:not">:not</a></code>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/::selection">::selection</a></code>, etc.) work. If you want to use these in your CSS and you need to support older IE versions, a good move is to use Keith Clark's <a href="http://selectivizr.com/">Selectivizr</a> library — this is a small JavaScript library that works on top of an existing JavaScript library like <a href="http://jquery.com/">jQuery</a> or <a href="http://mootools.net/">MooTools</a>.</p>
+
+<ol>
+ <li>To try this example, make a local copy of <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/html-css/selectivizr-example-start.html">selectivizr-example-start.html</a>. If you look at this running live, you'll see that it contains two paragraphs, one of which is styled. We've selected the paragraph with <code>p:first-child</code>, which won't work in old versions of IE.</li>
+ <li>Now download <a href="http://mootools.net/">MooTools</a> and <a href="http://selectivizr.com/">Selectivizr</a>, and save them in the same directory as your sample HTML.</li>
+ <li>Put the following code into the head of your HTML document, just before the opening <code>&lt;style&gt;</code> tag:
+ <pre class="brush: html line-numbers language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;</span>script</span> <span class="attr-name token">type</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>text/javascript<span class="punctuation token">"</span></span> <span class="attr-name token">src</span><span class="attr-value token"><span class="punctuation token">=</span><span class="punctuation token">"</span>MooTools-Core-1.6.0.js<span class="punctuation token">"</span></span><span class="punctuation token">&gt;</span></span><span class="tag token"><span class="tag token"><span class="punctuation token">&lt;/</span>script</span><span class="punctuation token">&gt;</span></span>
+ <span class="comment token">&lt;!--[if (gte IE 6)&amp;(lte IE 8)]&gt;
+ &lt;script type="text/javascript" src="selectivizr-min.js"&gt;&lt;/script&gt;
+ &lt;![endif]--&gt;</span></code></pre>
+ </li>
+</ol>
+
+<ol>
+ <li> </li>
+</ol>
+
+<p>If you try running this in an old version of IE, it should work fine.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14137/new-selector-ie7.png" style="border-style: solid; border-width: 1px; display: block; height: 516px; margin: 0px auto; width: 771px;"></p>
+
+<h4 id="Handling_CSS_prefixes">Handling CSS prefixes</h4>
+
+<p>Another set of problems comes with CSS prefixes — these are a mechanism orignally used to allow browser vendors to implement their own version of a CSS (or JavaScript) feature while the technology is in an experimental state, so they can play with it and get it right without conflicting with other browser's implementations, or the final unprefixed implementations. So for example:</p>
+
+<ul>
+ <li>Mozilla uses <code>-moz-</code></li>
+ <li>Chrome/Opera/Safari use <code>-webkit-</code></li>
+ <li>Microsoft uses <code>-ms-</code></li>
+</ul>
+
+<p>Here's some examples:</p>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css"><span class="property token">-webkit-transform</span><span class="punctuation token">:</span> <span class="function token">rotate</span><span class="punctuation token">(</span><span class="number token">90</span><span class="token unit">deg</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+
+<span class="property token">background-image</span><span class="punctuation token">:</span> <span class="function token">-moz-linear-gradient</span><span class="punctuation token">(</span>left<span class="punctuation token">,</span>green<span class="punctuation token">,</span>yellow<span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="property token">background-image</span><span class="punctuation token">:</span> <span class="function token">-webkit-gradient</span><span class="punctuation token">(</span>linear<span class="punctuation token">,</span>left center<span class="punctuation token">,</span>right center<span class="punctuation token">,</span><span class="function token">from</span><span class="punctuation token">(</span>green<span class="punctuation token">)</span><span class="punctuation token">,</span><span class="function token">to</span><span class="punctuation token">(</span>yellow<span class="punctuation token">)</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="property token">background-image</span><span class="punctuation token">:</span> <span class="function token">linear-gradient</span><span class="punctuation token">(</span>to right<span class="punctuation token">,</span>green<span class="punctuation token">,</span>yellow<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+
+<p>The first line shows a {{cssxref("transform")}} property with a <code>-webkit-</code> prefix — this was needed to make transforms work in Chrome, etc. until the feature was finalized and such browsers added a prefix-free version of the property (at the time of writing, Chrome supported both versions).</p>
+
+<p>The last three lines show three different versions of the <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient">linear-gradient()</a></code> function, which is used to generate a linear gradient in the background of an element:</p>
+
+<ol>
+ <li>The first one has a <code>-moz-</code> prefix, and shows a slightly older version of the syntax (Firefox)</li>
+ <li>The second one has a <code>-webkit-</code> prefix, and shows an even older, proprietary version of the syntax (this is actually from a really old version of the WebKit engine).</li>
+ <li>The third one has no prefix, and shows the final version of the syntax (included in the <a href="https://drafts.csswg.org/css-images-3/#linear-gradients">CSS Image Values and Replaced Content Module Level 3 spec</a>, which defines this feature).</li>
+</ol>
+
+<p>Prefixed features were never supposed to be used in production websites — they are subject to change or removal without warning, and cause cross browser issues. This is particularly a problem when developers decide to only use say, the <code>-webkit- </code>version of a property — meaning that the site won't work in other browsers. This actually happens so much that other browsers have started to implement <code>-webkit-</code> prefixed versions of various CSS properties, so they will work with such code. Usage of prefixes by browser vendors has declined recently precisely because of these types of problems, but there are still some that need attention.</p>
+
+<p>If you insist on using prefixed features, make sure you use the right ones. You can look up what browsers require prefixes on MDN reference pages, and sites like <a href="http://caniuse.com/">caniuse.com</a>. If you are unsure, you can also find out by doing some testing directly in browsers.</p>
+
+<p>Try this simple example:</p>
+
+<ol>
+ <li>Open up google.com, or another site that has a prominent heading or other block level element.</li>
+ <li>Right/Cmd + click on the element in question and choose Inspect/Inspect element (or whatever the option is in your browser) — this should open up the dev tools in your browser, with the element highlighted in the DOM inspector.</li>
+ <li>Look for a feature you can use to select that element. For example, at the time of writing, the main Google logo had an ID of <code>hplogo</code>.</li>
+ <li>Store a reference to this element in a variable, for example:
+ <pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">var</span> test <span class="operator token">=</span> document<span class="punctuation token">.</span><span class="function token">getElementById</span><span class="punctuation token">(</span><span class="string token">'hplogo'</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+ </li>
+</ol>
+
+<ul>
+ <li> </li>
+ <li>Now try to set a new value for the CSS property you are interested in on that element; you can do this using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style">style</a> property of the element, for example try typing these into the JavaScript console:
+ <pre class="brush: js line-numbers language-js"><code class="language-js">test<span class="punctuation token">.</span>style<span class="punctuation token">.</span>transform <span class="operator token">=</span> <span class="string token">'rotate(90deg)'</span>
+test<span class="punctuation token">.</span>style<span class="punctuation token">.</span>webkitTransform <span class="operator token">=</span> <span class="string token">'rotate(90deg)'</span></code></pre>
+ </li>
+</ul>
+
+<ol>
+ <li> </li>
+</ol>
+
+<p>As you start to type the property name representation after the second dot (note that in JavaScript, CSS property names are written in lower camel case, not hyphenated), the JavaScript console should begin to autocomplete the names of the properties that exist in the browser and match what you've written so far. This is useful for finding out what versions of the property are implemented in that browser.</p>
+
+<p>At the time of writing, both Firefox and Chrome implemented <code>-webkit-</code> prefixed and non-prefixed versions of {{cssxref("transform")}}!</p>
+
+<p>Once you've found out which prefixes you need to support, you should write them all out in your CSS, for example:</p>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css"><span class="property token">-ms-transform</span><span class="punctuation token">:</span> <span class="function token">rotate</span><span class="punctuation token">(</span><span class="number token">90</span><span class="token unit">deg</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="property token">-webkit-transform</span><span class="punctuation token">:</span> <span class="function token">rotate</span><span class="punctuation token">(</span><span class="number token">90</span><span class="token unit">deg</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+<span class="property token">transform</span><span class="punctuation token">:</span> <span class="function token">rotate</span><span class="punctuation token">(</span><span class="number token">90</span><span class="token unit">deg</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+
+<p>This ensures that all browsers that support any of the above forms of the property can make the feature work. It is worth putting the non-prefixed version last, because that will be the most up-to-date version, which you'll want browsers to use if possible. If for example a browser implements both the <code>-webkit-</code> version and the non-prefixed version,  it will first apply the <code>-webkit-</code> version, then override it with the non-prefixed version. You want it to happen this way round, not the other way round.</p>
+
+<p>Of course, doing this for lots of different CSS rules can get really tedious. It is better to use an automation tool to do it for you. And such tools exist:</p>
+
+<p>The <a href="http://leaverou.github.io/prefixfree/">prefix-free JavaScript library</a> can be attached to a page, and will automatically detect what capabilities are possessed by browsers viewing the page and add prefixes as appropriate. It is really easy and convenient to use, although it does have some downsides (see the link above for details), and it is arguable that parsing every stylesheet in your site and add prefixes at run time can be a drain on the computer's processing power for a large site.</p>
+
+<p>Another solution is to add prefixes automatically during development, and this (and other things besides) can be done using tools like <a href="https://github.com/postcss/autoprefixer">Autoprefixer</a> and <a href="http://postcss.org/">PostCSS</a>. These tools can be used in a variety of ways, for example Autoprefixer has an <a href="http://autoprefixer.github.io/">online version</a> that allows you to enter your non-prefixed CSS on the left, and gives you a prefix-added version on the right. You can choose which browsers you want to make sure you support using the notation outlined in <a href="https://github.com/postcss/autoprefixer#options">Autoprefixer options</a>; also see <a href="https://github.com/ai/browserslist#queries">Browserslist queries</a>, which this is based on, for more detail. As an example, the following query will select the last 2 versions of all major browsers and versions of IE above 9.</p>
+
+<pre class="line-numbers language-html"><code class="language-html">last 2 versions, ie &gt; 9</code></pre>
+
+<p>Autoprefixer can also be used in other, more convenient ways — see <a href="https://github.com/postcss/autoprefixer#usage">Autoprefixer usage</a>. For example you can use it with a task runner/build tool such as <a href="http://gulpjs.com/">Gulp</a> or <a href="https://webpack.github.io/">Webpack</a> to automatically add prefixes once development has been done. (Explaining how these work is somewhat beyond the scope of this article.)</p>
+
+<p>You can also use a plugin for a text editor such as Atom or Sublime text. For example, in Atom:</p>
+
+<ol>
+ <li>You can install it by going to <em>Preferences &gt; Install</em>, searching for <em>Autoprefixer</em>, then hitting install.</li>
+ <li>You can set a browser query by pressing the Autoprefixer <em>Settings</em> button and entering the query in the text field in the <em>Settings</em> section on the page.</li>
+ <li>In your code, you can select sections of CSS you want to add prefixes to, open the command pallette (<em>Cmd/Ctrl + Shift + P</em>), then type in Autoprefixer and select the Autoprefixer result that autocompletes.</li>
+</ol>
+
+<p>As an example, we entered the following code:</p>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css"><span class="selector token">body</span> <span class="punctuation token">{</span>
+ <span class="property token">display</span><span class="punctuation token">:</span> flex<span class="punctuation token">;</span>
+<span class="punctuation token">}</span></code></pre>
+
+<p>We highlighted it and ran the Autoprefixer command, and it replaced it with this:</p>
+
+<pre class="brush: css line-numbers language-css"><code class="language-css"><span class="selector token">body</span> <span class="punctuation token">{</span>
+ <span class="property token">display</span><span class="punctuation token">:</span> -webkit-box<span class="punctuation token">;</span>
+ <span class="property token">display</span><span class="punctuation token">:</span> -ms-flexbox<span class="punctuation token">;</span>
+ <span class="property token">display</span><span class="punctuation token">:</span> flex<span class="punctuation token">;</span>
+<span class="punctuation token">}</span></code></pre>
+
+<h3 id="Layout_issues">Layout issues</h3>
+
+<p>Another problem that might come up is differences in layouts between browsers. Historically this used to be much more of a problem, but recently, with modern browsers tending to support CSS more consistently, layout issues tend to be more commonly associated with:</p>
+
+<ul>
+ <li>Lack of (or differences in) support for modern layout features.</li>
+ <li>Layouts not looking good in mobile browsers (i.e. responsive design problems).</li>
+</ul>
+
+<div class="note">
+<p><strong>Note</strong>: Historically web developers used to use CSS files called resets, which removed all the default browser styling applied to HTML, and then applied their own styles for everything over the top — this was done to make styling on a project more consistent, and reduce possible cross browser issues, especially for things like layout. However, it has more recently been seen as overkill. The best equivalent we have in modern times is <a href="https://necolas.github.io/normalize.css/">normalize.css</a>, a neat bit of CSS that builds slightly on the default browser styling to make things more consistent and fix some layout issues. You are advised to apply normalize.css to all your HTML pages.</p>
+</div>
+
+<div class="note">
+<p><strong>Note</strong>:  When trying to track down a tricky layout issue, a good technique is to add a brightly colored {{cssxref("outline")}} to the offending element, or all the elements nearby. This makes it a lot easier to see where everything is placed. See <a href="http://www.otsukare.info/2016/10/05/debugging-css" rel="bookmark" title="Permalink to Debug your CSS with outline visualizations.">Debug your CSS with outline visualizations</a> for more details.</p>
+</div>
+
+<h4 id="Support_for_new_layout_features">Support for new layout features</h4>
+
+<p>Much of the layout work on the web today is done using <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Floats">floats</a> — this is because floats are well-supported (way back to IE4, albeit with a number of bugs that would also need to be investigated if you were to try to support IE that far back). However, they are not really meant for layout purposes — using floats the way we do is really a hack — and they do have some serious limitations (e.g. see <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox#Why_Flexbox">Why Flexbox?</a>)</p>
+
+<p>More recently, dedicated layout mechanisms have appeared, like <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox">Flexbox</a> and <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids#Native_CSS_Grids_with_Grid_Layout">CSS Grids</a>, which make common layout tasks far easier and remove such shortcomings. These however are not as well-supported in browsers:</p>
+
+<ul>
+ <li>CSS grids are very new; at the time of writing, they were only <a href="http://gridbyexample.com/browsers/">supported</a> in the very newest versions of modern browsers.</li>
+ <li>Flexbox is <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox#Cross_browser_compatibility">well-supported</a> in modern browsers, but provides problems in older browsers. IE 9 doesn't support it at all, and IE 10 and old versions of iOS/desktop Safari respectively support incompatible old versions of the flexbox spec. This results in some interesting browser prefix juggling if you want to try to use flexbox across all these browsers (see <a href="https://dev.opera.com/articles/advanced-cross-browser-flexbox/">Advanced Cross-Browser Flexbox</a> to get an idea).</li>
+</ul>
+
+<p>Layout features aren't as easy to provide graceful fallbacks for than simple colors, shadows, or gradients. If layout properties are ignored, your entire design will likely fall to pieces. Because of this, you need to use feature detection to detect whether visiting browsers support those layout features, and selectively apply different layouts depending on the result (we will cover feature detection in detail in a later article).</p>
+
+<p>For example, you could apply a flexbox layout to modern browsers, then instead apply a floated layout to older browsers that don't support flexbox.</p>
+
+<div class="note">
+<p><strong>Note</strong>: There is a fairly new feature in CSS called <code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@supports">@supports</a></code>, which allows you to implement native feature detection tests.</p>
+</div>
+
+<h4 id="Responsive_design_problems">Responsive design problems</h4>
+
+<p>Responsive design is the practice of creating web layouts that change to suit different device form factors — for example different screen widths, orientations (portrait or landscape), or resolutions. A desktop layout for example will look terrible when viewed on a mobile device, so you need to provide a suitable mobile layout using <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries">media queries</a>, and make sure it is applied correctly using <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag">viewport</a>. You can find a detailed account of such practices in <a href="https://developer.mozilla.org/en-US/docs/Web/Apps/Progressive/Responsive/responsive_design_building_blocks">The building blocks of responsive design</a>.</p>
+
+<p>Resolution is a big issue too — for example, mobile devices are less likely to need big heavy images than desktop computers, and are more likely to have slower internet connections and possibly even expensive data plans that make wasted bandwidth more of a problem. In addition, different devices can have a range of different resolutions, meaning that smaller images could appear pixellated. There are a number of techniques that allow you to work around such problems, from simple <a href="https://developer.mozilla.org/en-US/Apps/Progressive/Responsive/Mobile_first">mobile first media queries</a>, to more complex <a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images#Resolution_switching_Different_sizes">responsive image techniques</a>.</p>
+
+<p>Another difficulty that can present problems is browser support for the features that make the above techniques possible. media queries are not supported in IE 8 or less, so if you want to use a mobile first layout and have the desktop layout then apply to old IE versions, you'll have to apply a media query {{glossary("polyfill")}} to your page, like <a href="https://code.google.com/archive/p/css3-mediaqueries-js/">css3-mediaqueries-js</a>, or <a href="https://github.com/scottjehl/Respond">Respond.js</a>.</p>
+
+<h2 id="Finding_help">Finding help</h2>
+
+<p>There are many other issues you'll encounter with HTML and CSS; the most important thing to know really is how to find answers online.</p>
+
+<p>Among the best sources of support information are the Mozilla Developer Network (that's where you are now!), <a href="http://stackoverflow.com/">stackoverflow.com</a>, and <a href="http://caniuse.com/">caniuse.com</a>.</p>
+
+<p>To use the Mozilla Developer Network (MDN), most people do a search engine search of the technology they are trying to find information on, plus the term "mdn", for example "mdn HTML5 video". MDN contains several useful types of content:</p>
+
+<ul>
+ <li>Reference material with browser support information for client-side web technologies, e.g. the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video">&lt;video&gt; reference page</a>.</li>
+ <li>Other supporting reference material, e.g. <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats">Media formats supported by the HTML audio and video elements</a>.</li>
+ <li>Useful tutorials that solve specific problems, for example <a href="https://developer.mozilla.org/en-US/docs/Web/Apps/Fundamentals/Audio_and_video_delivery/cross_browser_video_player">Creating a cross-browser video player</a>.</li>
+</ul>
+
+<p><a href="http://caniuse.com/">caniuse.com</a> provides support information, along with a few useful external resource links. For example, see <a href="http://caniuse.com/#search=video">http://caniuse.com/#search=video</a> (you just have to enter the feature you are searching for into the text box).</p>
+
+<p><a href="http://stackoverflow.com/">stackoverflow.com</a> (SO) is a forum site where you can ask questions and have fellow developers share their solutions, look up previous posts, and help other developers. You are advised to look and see if there is an answer to your question already, before posting a new question. For example, we searched for "cross browser html5 video" on SO, and very quickly came up with <a class="question-hyperlink" href="http://stackoverflow.com/questions/16212510/html5-video-with-full-cross-browser-compatibility">HTML5 Video with full cross browser compatibility</a>.</p>
+
+<p>Aside from that, try searching your favourite search engine for an answer to your problem. It is often useful to search for specific error messages if you have them — other developers will be likely to have had the same problems as you.</p>
+
+<h2 id="まとめ">まとめ</h2>
+
+<p>Now you should be familiar with the main types of cross browser HTML and CSS problems that you'll meet in web development, and how to go about fixing them.</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies","Learn/Tools_and_testing/Cross_browser_testing/JavaScript", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+<h2 id="このモジュール">このモジュール</h2>
+
+<ul>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">Introduction to cross browser testing</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">Strategies for carrying out testing</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">Handling common HTML and CSS problems</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">Handling common JavaScript problems</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">Handling common accessibility problems</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">Implementing feature detection</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">Introduction to automated testing</a></li>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">Setting up your own test automation environment</a></li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/index.html
new file mode 100644
index 0000000000..d3a0da5fa8
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/index.html
@@ -0,0 +1,47 @@
+---
+title: クロスブラウザテスト
+slug: Learn/Tools_and_testing/Cross_browser_testing
+tags:
+ - Accessibility
+ - Automation
+ - Beginner
+ - CSS
+ - CodingScripting
+ - HTML
+ - JavaScript
+ - Landing
+ - Learn
+ - Module
+ - Testing
+ - Tools
+ - cross browser
+translation_of: Learn/Tools_and_testing/Cross_browser_testing
+---
+<div>{{LearnSidebar}}</div>
+
+<p class="summary">このモジュールでは、色々なウェブブラウザー間でウェブプロジェクトをテストすることに焦点を当てます。あなたのターゲット視聴者 (例 どのユーザー、ブラウザー、デバイスに一番関心があるのか?) の特定や、テストをどう動かすかや、主な問題としてさまざまな種類のコードと対面してそれらを緩和する方法や、テストを楽にして問題を解決するのに最も役立つツールが何かや、自動化を利用してテストをスピードアップする方法を見て行きます。</p>
+
+<h2 id="前提条件">前提条件</h2>
+
+<p>ここで述べるツールを使ってみる前に、基本的な <a href="/ja/docs/Learn/HTML">HTML</a>、<a href="/ja/docs/Learn/CSS">CSS</a>、 <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語をよく理解しておきます。</p>
+
+<h2 id="ガイド">ガイド</h2>
+
+<dl>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">はじめてのクロスブラウザーテスト</a></dt>
+ <dd>この記事ではクロスブラウザーテストの概観を提供し始めます。その過程で「ブラウザーテストとは何?」「どんな種類の問題によく出くわしますか?」「テストと、問題の特定・修正の主なアプローチは?」といった質問に答えたりします。</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">テスト実行戦略</a></dt>
+ <dd>次に、テスト実行について掘り下げ、ターゲット視聴者(例、どのブラウザー、デバイス、その他のセグメントでテストを確実にするのか)を特定し、ローファイテスト戦略(ある範囲のデバイスと仮装マシンにて必要ならアドホックテストを行う)、高度なテスト戦略(専用テストアプリを使った自動化)、ユーザーグループを使ったテストまで見て行きます。</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">よくあるHTML や</a><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS"> CSS の問題を扱う</a></dt>
+ <dd>シーンがセットされたら、HTMLとCSSコードの中でよく出くわすクロスブラウザー問題と、問題を防いだり、問題発生を修正するのに使えるツールを詳しく見ていきます。これにはコードの lint や、CSSプレフィックスを手渡したり、問題を監視するブラウザーの開発ツールを使ったり、ブラウザーサポート追加に polyfill を使ったり、レスポンシブデザインの問題に取り組んだり、といった事が含まれます</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">よくある JavaScript の問題を扱う</a></dt>
+ <dd>今度はクロスブラウザー JavaScript の問題と、その修正方法を見て行きます。ここにはブラウザーの開発ツールを使って問題を突き止めて修正したり、問題を回避するのに pollyfill やライブラリーを使用したり、古いブラウザーの対応にモダン JavaScript の機能を掴んだり、といった事が含まれます。</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">よくあるアクセシビリティの問題を扱う</a></dt>
+ <dd>次にアクセシビリティに注意を向けて、良くある問題の情報、簡単なテスト実施の方法、アクセシビリティの問題を見つけるための監査/自動化ツールの利用方法を提供します。</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">機能検出の実装</a></dt>
+ <dd>機能検出はブラウザーがあるコードブロックをサポートしているか考えたり、サポートする/しないによって他のコードを実行したりして、いくつかのブラウザーでクラッシュ/エラー起こすことなく、常に動作の体験を提供できるようにすることです。この記事では簡単な機能検出を書く方法や、 <code>@supports</code> のようなネイティブ機能について詳しく記載します。</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">はじめての自動テスト</a></dt>
+ <dd>いくつかのブラウザーと端末で、一日に何度もテストを手動実行するのはつまらないし時間をつぶします。これを効率良く扱うには、自動化ツールに詳しくなるべきです。この記事では何を入手できるかや、タスクランナーの使い方や、Sauce Labs と Browser Stack のような商用ブラウザーテスト自動化ツールの使い方の基本を見て行きます。</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">テスト自動化環境をセットアップする</a></dt>
+ <dd>この記事では、Selenium/WebDriver や selenium-webdriver for Node のようなテストライブラリーを使って、自動化環境のインストールとテストを実行する方法を教えます。またあなたのローカルテスト環境と、以前の記事で見てきたような商用アプリとを統合する方法についても見て行きます。</dd>
+</dl>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/introduction/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/introduction/index.html
new file mode 100644
index 0000000000..3e0e2e7834
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/introduction/index.html
@@ -0,0 +1,209 @@
+---
+title: はじめてのクロスブラウザテスト
+slug: Learn/Tools_and_testing/Cross_browser_testing/Introduction
+tags:
+ - Article
+ - Beginner
+ - CodingScripting
+ - Learn
+ - Testing
+ - concepts
+ - cross browser
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/Introduction
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{NextMenu("Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">この記事では (クロス) ブラウザテストのトピックの概要を説明し、「クロスブラウザテストとは何ですか?」、「発生する最も一般的な問題の種類は何ですか?」、「問題のテスト、特定、および修正のための主なアプローチは?」などの質問に答えながらモジュールを始めます。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提知識:</th>
+ <td><a href="/ja/docs/Learn/HTML">HTML</a>, <a href="/ja/docs/Learn/CSS">CSS</a>, <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語の基礎に精通していること。</td>
+ </tr>
+ <tr>
+ <th scope="row">目的:</th>
+ <td>クロスブラウザテストに関する高レベルのコンセプトを理解する。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="What_is_cross_browser_testing" name="What_is_cross_browser_testing">クロスブラウザテストとは?</h2>
+
+<p>クロスブラウザテストは、作成した Web サイトと Web アプリケーションが許容できる数の Web ブラウザにわたって動作することを確認することです。Web 開発者として、自分のプロジェクトが機能するだけでなく、使用しているブラウザ、デバイス、その他の補助ツールに関係なく、すべてのユーザに対して機能することを確認するのはあなたの責任です。あなたは考える必要があります:</p>
+
+<ul>
+ <li>普段自分が使っているブラウザ以外にも、数多くのブラウザが存在します。また、人によっては少し古いバージョンを使用していて、最新の CSS や JavaScript 機能をサポートしていない場合もあります。</li>
+ <li>ウェブにアクセスするデバイスは様々で、最新の高性能タブレットやスマートフォンから、スマートTVからのアクセス、廉価なタブレットや、少し古いフィーチャーフォンに搭載されている機能が限定されたブラウザなどもあります。</li>
+ <li>障がいを持った人で、スクリーンリーダーのような補助技術を使ってウェブを使用していたり、マウスを使わずにキーボードだけでブラウズしたりする人もいます。</li>
+</ul>
+
+<p>ユーザーの状況は一人ひとり異なってきます — 自分の Macbook Pro やハイエンドな Galaxy Nexus で動いても、すべてのユーザーにとって動作するとは限りません 。それを確認するには膨大な数のテストが必要になってきます。</p>
+
+<div class="note">
+<p><strong>注</strong>: <a href="https://hacks.mozilla.org/2016/07/make-the-web-work-for-everyone/">Make the web work for everyone</a> では、人々が使っているさまざまなブラウザの種類やそれぞれのマーケットシェア、それに伴うクロスブラウザの懸念点などが説明されています。</p>
+</div>
+
+<p>ここでいくつかの用語を説明します。最初に、「クロスブラウザでの動作」と言う時、様々なブラウザ間で受け入れられるユーザー体験が提供されることを言います。サイトがすべてのブラウザでまったく同一の体験が提供していなくても、コア機能がいくつかの方法で受け入れられる限りは、潜在的にOKです。モダンブラウザではアニメーションや3Dや目立つものがあり、いっぽう古いブラウザでは平坦なグラフィックで同じ情報を表すだけのこともあるでしょう。サイト所有者が満足している限り、あなたの仕事は完了です。</p>
+
+<p>その一方で、サイトが視力のあるユーザーにとって動作していても、視覚障がいのあるユーザーにとって、スクリーンリーダーアプリケーションがそこにある情報を読み取れないため完全にアクセスできない場合は、OKではありません。</p>
+
+<p>2つ目に、「受け入れられる数のウェブブラウザ間で」と言った時、世界中のブラウザの 100% の意味ではありません — これは不可能です。ユーザーが使うブラウザや端末の情報を呼び出すことができます (このシリーズの2つ目の記事で見ていきましょう — <a href="https://developer.mozilla.org/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies#Gotta_test_%27em_all">Gotta test 'em all?</a>を見てください)が、すべてを保証することはできません。ウェブ開発者としては、ある範囲のブラウザと端末にてコードが完全に動作することをサイトオーナーと同意しておく必要があります。しかしそれを超えて、その他のブラウザでコンテンツを使う機会をできるだけ与えられるよう防衛的なコードを書いておく必要があります。</p>
+
+<div class="note">
+<p><strong>注</strong>: このモジュールの後の方でも、防衛的なコードをカバーします。</p>
+</div>
+
+<h2 id="Why_do_cross_browser_issues_occur" name="Why_do_cross_browser_issues_occur">なぜクロスブラウザ問題が起きるのか?</h2>
+
+<p>クロスブラウザ問題が生じる原因はたくさんあります。そして、本記事ではブラウザ・端末・ブラウザの設定によって生じる問題について述べます。クロスブラウザの問題に取り組む前に、ソース中のバグを解決するべきです(必要に応じて前述の<a href="/ja/docs/Learn/HTML/Introduction_to_HTML/Debugging_HTML">Debugging HTML</a>, <a href="/ja/docs/Learn/CSS/Introduction_to_CSS/Debugging_CSS">Debugging CSS</a>, and <a href="/ja/docs/Learn/JavaScript/First_steps/What_went_wrong">What went wrong? Troubleshooting JavaScript</a>の記事を見て記憶を呼び覚ましてください)。</p>
+
+<p>クロスブラウザ問題が発生する原因は主に以下になります。</p>
+
+<ul>
+ <li>時々ブラウザにはバグがあったり、異なる仕様で機能が実装されています。この状況はかつてよりはましになっています。1990年代にIE4とNetscape4がブラウザの支配権を争っっていたとき、ブラウザ会社は意図的に競争優位性を得るために互いに異なる実装をしていました。これは開発者にとってはたまったもんじゃありませんでした。今日ではそのときに比べてはブラウザを取り巻く環境は遥かにましになっています。しかし、それでもブラウザ間での違いやバグは時々あります。</li>
+ <li> ブラウザ間で機能についてのサポートのレベルが異なる場合があります。これは実装されたばかりの最先端の機能を使おうとした場合や新しい機能が開発されるよりずっと前に開発終了になったものすごく古いブラウザをサポートする場合には避けることはできません。たとえば、自分のサイトでJavaScript最新の機能を使いたい場合、これらの機能は古いブラウザでは動作しないかもしれません。もし古いブラウザをサポートする必要があるならそれらの機能を使わないかクロスコンパイラを使って古い書き方に変換する必要があります。</li>
+ <li>端末によっては制約があり、それによってウェブサイトの表示が遅くなったり表示がおかしくなったりします。たとえば、デスクトップPCでよく見えるように意図されたサイトは、携帯端末ではひょっとすると小さく読むのが難しかったりするかもしれません。また大量のアニメーションを読み込むサイトは、ハイスペックのタブレットでは大丈夫かもしれませんが、低スペックの端末ではカクつくかもしれません。</li>
+</ul>
+
+<p>上記の他にも理由はあります。</p>
+
+<p>後述の記事では、クロスブラウザ問題についてよくある問題について掘り下げ、解決策を提示します。</p>
+
+<h2 id="Workflows_for_cross_browser_testing" name="Workflows_for_cross_browser_testing">クロスブラウザテストの作業手順</h2>
+
+<p>All of this cross browser testing business may sound time consuming and scary, but it needn't be — you just need to plan carefully for it, and make sure you do enough testing in the right places to make sure you don't run into unexpected problems. If you are working on a large project, you should be testing it regularly, to make sure that new features work for your target audience, and that new additions to the code don't break old features that were previously working.</p>
+
+<p>If you leave all the testing to the end of a project, any bugs you uncover will be a lot more expensive and time consuming to fix than if you uncover them and fix them as you go along.</p>
+
+<p>The workflow for testing and bug fixes on a project can be broken down into roughly the following four phases (this is only very rough — different people may do things quite differently to this):</p>
+
+<p><strong>Initial planning &gt; Development &gt; Testing/discovery &gt; Fixes/iteration</strong></p>
+
+<p>Steps 2–4 will tend to be repeated as many times as necessary to get all of the implementation done. We will look at the different parts of the testing process in much greater detail in subsequent articles, but for now let's just summarize what may occur in each step.</p>
+
+<h3 id="Initial_planning" name="Initial_planning">初期計画</h3>
+
+<p>In the initial planning phase, you will probably have several planning meetings with the site owner/client (this might be your boss, or someone from an external company you are building a web site for), in which you determine exactly what the web site should be — what content and functionality should it have, what should it look like, etc. At this point you'll also want to know how much time you have to develop the site — what is their deadline, and how much are they going to pay you for your work? We won't go into much detail about this, but cross-browser issues can have a serious effect on such planning.</p>
+
+<p>Once you've got an idea of the required featureset, and what technologies you will likely build these features with, you should start exploring the target audience — what browsers, devices, etc. will the target audience for this site be using? The client might already have data about this from previous research they've done, e.g. from other web sites they own, or from previous versions of the web site you are now working on. If not, you will be able to get a good idea by looking at other sources, such as usage stats for competitors, or countries the site will be serving. You can also use a bit of intuition.</p>
+
+<p>So for example, you might be building an e-commerce site that serves customers in North America. the site should work entirely in the last few versions of the most popular desktop and mobile (iOS, Android, Windows phone) browsers — this should include Chrome (and Opera as it is based on the same rendering engine as Chrome), Firefox, IE/Edge, and Safari. It should also provide an acceptable experience on IE 8 and 9, and be accessible with WCAG AA compliance.</p>
+
+<p>Now you know your target testing platforms, you should go back and review the required featureset and what technologies you are going to use. For example, if the e-commerce site owner wants a WebGL-powered 3D tour of each product built into the product pages, they will need to accept that this just won't work in IE versions before 11. You'd have to agree to provide a version of the site without this feature to users of older IE versions.</p>
+
+<p>You should compile a list of the potential problem areas.</p>
+
+<div class="note">
+<p><strong>注</strong>: You can find browser support information for technologies by looking up the different features on MDN — the site you're on! You should also consult <a href="http://caniuse.com/">caniuse.com</a>, for some further useful details.</p>
+</div>
+
+<p>Once you've agreed on these details, you can go ahead and start developing the site.</p>
+
+<h3 id="Development" name="Development">開発</h3>
+
+<p>Now on to the development of the site. You should split the different parts of the development into modules, for example you might split the different site areas up — home page, product page, shopping cart, payment workflow, etc. You might then further subdivide these — implement common site header and footer, implement product page detail view, implement persistent shopping cart widget, etc.</p>
+
+<p>There are multiple general strategies to cross browser development, for example:</p>
+
+<ul>
+ <li>Get all the functionality working as closely as possible in all target browsers. This may involve writing different code paths that reproduce functionality in different ways aimed at different browsers, or using a {{glossary("Polyfill")}} to mimic any missing support using JavaScript or other technologies, or using a library that allows you to write a single bit of code and then does different things in the background depending on what the browser supports.</li>
+ <li>Accept that some things aren't going to work the same on all browsers, and provide different (acceptable) solutions in browsers that don't support the full functionality. Sometimes this is inevitable due to device constraints — a cinema widescreen isn't going to give the same visual experience as a 4" mobile screen, regardless of how you program your site.</li>
+ <li>Accept that your site just isn't going to work in some older browsers, and move on. This is OK, provided your client/userbase is OK with it.</li>
+</ul>
+
+<p>Normally your development will involve a combination of the above three approaches. The most important thing is that you test each small part before committing it — don't leave all the testing till the end!</p>
+
+<h3 id="Testingdiscovery" name="Testingdiscovery">テスト/発見</h3>
+
+<p>After each implementation phase, you will need to test the new functionality. To start with, you should make sure there are no general issues with your code that are stopping your feature from working:</p>
+
+<ol>
+ <li>Test it in a couple of stable browsers on your system, like Firefox, Safari, Chrome, or IE/Edge.</li>
+ <li>Do some low fi accessibility testing, such as trying to use your site with only the keyboard, or using your site via a screen reader to see if it is navigable.</li>
+ <li>Test on a mobile platform, such as Android or iOS.</li>
+</ol>
+
+<p>At this point, fix any problems you find with your new code.</p>
+
+<p>Next, you should try expanding your list of test browsers to a full list of target audience browsers and start concentrating on weeding out cross browser issues (see the next article for more information on <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies#Gotta_test_%27em_all">determining your target browsers</a>). For example:</p>
+
+<ul>
+ <li>Try to test the latest change on all the modern desktop browsers you can — including Firefox, Chrome, Opera, IE, Edge, and Safari on desktop (Mac, Windows, and Linux, ideally).</li>
+ <li>Test it in common phone and tablet browsers (e.g. iOS Safari on iPhone/iPad, Chrome and Firefox on iPhone/iPad/Android),</li>
+ <li>Also do tests in any other browsers you have included inside your target list.</li>
+</ul>
+
+<p>The most low fi option is to just do all the testing you can by yourself (pulling in team mates to help out if you are working in a  team). You should try to test it on real physical devices where possible.</p>
+
+<p>If you haven't got the means to test all those different browser, operating system, and device combinations on physical hardware, you can also make use of emulators (emulate a device using software on your desktop computer) and virtual machines (software that allows you to emulate multiple operating system/software combinations on your desktop computer). This is a very popular choice, especially in some circumstances — for example, Windows doesn't let you have multiple versions of Windows installed simulataneously on the same machine, so using multiple virtual machines is often the only option here.</p>
+
+<p>Another option is user groups — using a group of people outside your development team to test your site. This could be a group of friends or family, a group of other employees, a class at a local university, or a professional user testing setup, where people are paid to test out your site and provide results.</p>
+
+<p>Finally, you can get smarter with your testing using auditing or automation tools; this is a sensible choice as your projects get bigger, as doing all this testing by hand can start to take a really long time. You can set up your own testing automation system (<a href="http://www.seleniumhq.org/">Selenium</a> being the popular app of choice) that could for example load your site in a number of different browsers, and:</p>
+
+<ul>
+ <li>see if a button click causes something to happen successfully (like for example, a map displaying), displaying the results once the tests are completed</li>
+ <li>take a screenshot of each, allowing you to see if a layout is consistent across the different browsers.</li>
+</ul>
+
+<p>You can also go further than this, if wished. There are commercial tools available such as <a href="https://saucelabs.com/">Sauce Labs</a>, <a href="https://www.browserstack.com/">Browser Stack</a>, <a href="https://www.lambdatest.com/">LambdaTest</a>, <a href="https://testingbot.com">TestingBot</a>, and <a href="https://crossbrowsertesting.com">CrossBrowserTesting</a> that do this kind of thing for you, without you having to worry about the setup, if you wish to invest some money in your testing. It is also possible to set up an environment that automatically runs tests for you, and then only lets you check in your changes to the central code repository if the tests still pass.</p>
+
+<h4 id="Testing_on_prerelease_browsers" name="Testing_on_prerelease_browsers">Testing on prerelease browsers</h4>
+
+<p>It is often a good idea to test on prerelease versions of browsers; see the following links:</p>
+
+<ul>
+ <li><a href="https://www.mozilla.org/en-US/firefox/developer/">Firefox Developer Edition</a></li>
+ <li><a href="https://insider.windows.com/">Edge Insider Preview</a></li>
+ <li><a href="https://developer.apple.com/safari/technology-preview/">Safari Technology Preview</a></li>
+ <li><a href="https://www.google.com/chrome/browser/canary.html">Chrome Canary</a></li>
+ <li><a href="http://www.opera.com/computer/beta">Opera Developer</a></li>
+</ul>
+
+<p>This is especially prevalent if you are using very new technologies in your site, and you want to test against the latest implementations, or if you are coming across a bug in the latest release version of a browser, and you want to see if the browser's developers have fixed the bug in a newer version.</p>
+
+<h3 id="Fixesiteration" name="Fixesiteration">修正/繰り返し</h3>
+
+<p>Once you've discovered a bug, you need to try to fix it.</p>
+
+<p>The first thing to do is to narrow down where the bug occurs as much as possible. Get as much information as you can from the person reporting the bug — what platform(s), device(s), browser version(s), etc. Try it on similar configurations (e.g. the same browser version on different desktop platforms, or a few different versions of the same browser on the same platform) to see how widely the bug persists.</p>
+
+<p>It might not be your fault — if a bug exists in a browser, then hopefully the vendor will rapidly fix it. It might have already been fixed — for example if a bug is present in Firefox release 49, but it is no longer there in Firefox Nightly (version 52), then they have fixed it. If it is not fixed, then you may want to file a bug (see {{anch("Reporting bugs")}}, below).</p>
+
+<p>If it is your fault, you need to fix it! Finding out the cause of the bug involves the same strategy as any web development bug (again, see <a href="/ja/docs/Learn/HTML/Introduction_to_HTML/Debugging_HTML">Debugging HTML</a>, <a href="/ja/docs/Learn/CSS/Introduction_to_CSS/Debugging_CSS">Debugging CSS</a>, and <a href="/ja/docs/Learn/JavaScript/First_steps/What_went_wrong">What went wrong? Troubleshooting JavaScript</a>). Once you've discovered what is causing your bug, you need to decide how to work around it in the particular browser it is causing problems in — you can't just change the problem code outright, as this may break the code in other browsers. The general approach is usually to fork the code in some way, for example use JavaScript feature detection code to detect situations in which a problem feature doesn't work, and run some different code in those cases that does work.</p>
+
+<p>Once a fix has been made, you'll want to repeat your testing process to make sure your fix is working OK, and hasn't caused the site to break in other places or in other browsers.</p>
+
+<h2 id="Reporting_bugs" name="Reporting_bugs">バグを報告する</h2>
+
+<p>ブラウザでバグを発見した場合は、上記で述べたことを繰り返しますが、それらを報告する必要があります。</p>
+
+<ul>
+ <li><a href="https://bugzilla.mozilla.org/">Firefox Bugzilla</a></li>
+ <li><a href="https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/">EdgeHTML issue tracker</a></li>
+ <li><a href="https://bugs.webkit.org/">Safari</a></li>
+ <li><a href="https://bugs.chromium.org/p/chromium/issues/list">Chrome</a></li>
+ <li><a href="https://bugs.opera.com/wizard/desktop">Opera</a></li>
+</ul>
+
+<h2 id="Summary" name="Summary">要約</h2>
+
+<p>この記事では、クロスブラウザテストに関して知っておくべき最も大事な概念について、高位の理解を与えてきました。この知識を備えたことで、クロスブラウザテストの戦略について学び始める準備ができています。</p>
+
+<p>{{NextMenu("Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+<h2 id="In_this_module" name="In_this_module">このモジュール内</h2>
+
+<ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">Introduction to cross browser testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">Strategies for carrying out testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">Handling common HTML and CSS problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">Handling common JavaScript problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">Handling common accessibility problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">Implementing feature detection</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">Introduction to automated testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">Setting up your own test automation environment</a></li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/javascript/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/javascript/index.html
new file mode 100644
index 0000000000..12c8f274d6
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/javascript/index.html
@@ -0,0 +1,521 @@
+---
+title: JavaScript のよくある問題を扱う
+slug: Learn/Tools_and_testing/Cross_browser_testing/JavaScript
+tags:
+ - Article
+ - Beginner
+ - CodingScripting
+ - JavaScript
+ - Learn
+ - Libraries
+ - Testing
+ - cross browser
+ - feature detection
+ - linting
+ - polyfills
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/JavaScript
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS","Learn/Tools_and_testing/Cross_browser_testing/Accessibility", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">ここではよくあるクロスブラウザー JavaScript 問題と、その直し方を見てみます。これにはブラウザーの開発ツールを使って問題をつきとめて修正したり、問題の回避に Polyfills やライブラリーを使ったりモダンな JavaScript 機能を古いブラウザーで使ったりなどです。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提知識:</th>
+ <td>Familiarity with the core <a href="/ja/docs/Learn/HTML">HTML</a>, <a href="/ja/docs/Learn/CSS">CSS</a>, and <a href="/ja/docs/Learn/JavaScript">JavaScript</a> languages; an idea of the high-level <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">principles of cross browser testing</a>.</td>
+ </tr>
+ <tr>
+ <th scope="row">狙い:</th>
+ <td>To be able to diagnose common JavaScript cross-browser problems, and use appropriate tools and techniques to fix them.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="The_trouble_with_JavaScript" name="The_trouble_with_JavaScript">JavaScript のトラブル</h2>
+
+<p>Historically, JavaScript was plagued with cross-browser compatibility problems — back in the 1990s, the main browser choices back then (Internet Explorer and Netscape) had scripting implemented in different language flavours (Netscape had JavaScript, IE had JScript and also offered VBScript as an option), and while at least JavaScript and JScript were compatible to some degree (both based on the {{glossary("ECMAScript")}} specification), things were often implemented in conflicting, incompatible ways, causing developers many nightmares.</p>
+
+<p class="entry-title">Such incompatibility problems persisted well into the early 2000s, as old browsers were still being used and still needed supporting. This is one of the main reasons why libraries like <a href="http://jquery.com/">jQuery</a> came into existence — to abstract away differences in browser implementations (e.g. see the code snippet in <a href="/ja/docs/AJAX/Getting_Started#Step_1_%E2%80%93_How_to_make_an_HTTP_request">How to make an HTTP request</a>) so developers only have to write one simple bit of code (see <code><a href="http://api.jquery.com/jquery.ajax/">jQuery.ajax()</a></code>). jQuery (or whatever library you are using) will then handle the differences in the background, so you don't have to.</p>
+
+<p>Things have got much better since then; modern browsers do a good job of supporting "classic JavaScript features", and the requirement to use such code has diminished as the requirement to support older browsers has lessened (although bear in mind that they have not gone away altogether).</p>
+
+<p>These days, most cross-browser JavaScript problems are seen:</p>
+
+<ul>
+ <li>When bad quality browser sniffing code, feature detection code, and vendor prefix usage blocks browsers from running code they could otherwise use just fine.</li>
+ <li>When developers make use of new/nascent JavaScript features (for example <a href="/ja/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla">ECMAScript 6</a> / <a href="/ja/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_Next_support_in_Mozilla">ECMAScript Next</a> features, modern Web APIs...) in their code, and find that such features don't work in older browsers.</li>
+</ul>
+
+<p>We'll explore all these problems and more below.</p>
+
+<h2 id="Fixing_general_JavaScript_problems" name="Fixing_general_JavaScript_problems">一般的な JavaScript の問題を修正する</h2>
+
+<p>As we said in the <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#First_things_first_fixing_general_problems">previous article</a> on HTML/CSS, you should make sure your code is working generally, before going on to concentrate on the cross-browser issues. If you are not already familiar with the basics of <a href="/ja/docs/Learn/JavaScript/First_steps/What_went_wrong">Troubleshooting JavaScript</a>, you should study that article before moving on. There are a number of common JavaScript problems that you will want to be mindful of, such as:</p>
+
+<ul>
+ <li>Basic syntax and logic problems (again, check out <a href="/ja/docs/Learn/JavaScript/First_steps/What_went_wrong">Troubleshooting JavaScript</a>).</li>
+ <li>Making sure variables, etc. are defined in the correct scope, and you are not running into conflicts between items declared in different places (see <a href="/ja/docs/Learn/JavaScript/Building_blocks/Functions#Function_scope_and_conflicts">Function scope and conflicts</a>).</li>
+ <li>Confusion about <a href="/ja/docs/Web/JavaScript/Reference/Operators/this">this</a>, in terms of what scope it applies to, and therefore if its value is what you intended. You can read <a href="/ja/docs/Learn/JavaScript/Objects/Basics#What_is_this">What is "this"?</a> for a light introduction; you should also study examples like <a href="https://github.com/mdn/learning-area/blob/7ed039d17e820c93cafaff541aa65d874dde8323/javascript/oojs/assessment/main.js#L143">this one</a>, which shows a typical pattern of saving a <code>this</code> scope to a separate variable, then using that variable in nested functions so you can be sure you are applying functionality to the correct <code>this</code> scope.</li>
+ <li>Incorrectly using functions inside loops — for example, in <a href="https://mdn.github.io/learning-area/tools-testing/cross-browser-testing/javascript/bad-for-loop.html">bad-for-loop.html</a> (see <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/bad-for-loop.html">source code</a>), we loop through 10 iterations, each time creating a paragraph and adding an <a href="/ja/docs/Web/API/GlobalEventHandlers/onclick">onclick</a> event handler to it. When clicked, each one should alert a message containing its number (the value of <code>i</code> at the time it was created), however each one reports <code>i</code> as 11, because for loops do all their iterating before nested functions are invoked. If you want this to work correctly, you need to define a function to add the handler separately, calling it on each iteration and passing it the current value of <code>para</code> and <code>i</code> each time (or something similar). See <a href="https://mdn.github.io/learning-area/tools-testing/cross-browser-testing/javascript/good-for-loop.html">good-for-loop.html</a> (see the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/good-for-loop.html">source code</a> also) for a version that works.</li>
+ <li>Making sure asynchronous operations have returned before trying to use the values they return. For example, <a href="/ja/docs/AJAX/Getting_Started#Step_3_%E2%80%93_A_Simple_Example">this Ajax example</a> checks to make sure the request is complete and the response has been returned before trying to use the response for anything. This kind of operation has been made easier to handle by the introduction to <a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promises</a> to the JavaScript language.</li>
+</ul>
+
+<div class="note">
+<p><strong>注</strong>: <a href="https://www.toptal.com/javascript/10-most-common-javascript-mistakes">Buggy JavaScript Code: The 10 Most Common Mistakes JavaScript Developers Make</a> has some nice discussions of these common mistakes and more.</p>
+</div>
+
+<h3 id="Linters" name="Linters">Linters</h3>
+
+<p><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Linters">HTML や CSS</a>と同じく、良い品質を保つことができて、エラーを示して悪いやり方の警告をつけ、エラー/警告の報告を厳しくもゆるくも変えられる Linterを使ってエラーがちな JavaScript コードを減らすことが確実にできます。我々が勧める JavaScript/ECMAScript linters は <a href="http://jshint.com/">JSHint</a> と <a href="http://eslint.org/">ESLint</a>; これらは色々な方法で使用でき、そのいくつかを以下で紹介します。</p>
+
+<h4 id="オンライン">オンライン</h4>
+
+<p>The <a href="http://jshint.com/">JSHint homepage</a> provides an online linter, which allows you to enter your JavaScript code on the left and provides an output on the right, including metrics, warnings, and errors.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14175/jshint-online.png" style="display: block; margin: 0 auto;"></p>
+
+<h4 id="Code_editor_plugins" name="Code_editor_plugins">コードエディターのプラグイン</h4>
+
+<p>It is not very convenient to have to copy and paste your code over to a web page to check its validity several times. What you really want is a linter that will fit into your standard workflow with the minimum of hassle. Many code editors have linter plugins, for example Github's <a href="https://atom.io/">Atom</a> code editor has a JSHint plugin available.</p>
+
+<p>To install it:</p>
+
+<ol>
+ <li>Install Atom (if you haven't got an up-to-date version already installed) — download it from the Atom page linked above.</li>
+ <li>Go to Atom's <em>Preferences...</em> dialog (e.g. by Choosing <em>Atom &gt; Preferences...</em> on Mac, or <em>File &gt; Preferences...</em> on Windows/Linux) and choose the <em>Install</em> option in the left-hand menu.</li>
+ <li>In the <em>Search packages</em> text field, type "jslint" and press Enter/Return to search for linting-related packages.</li>
+ <li>You should see a package called <strong>lint</strong> at the top of the list. Install this first (using the <em>Install</em> button), as other linters rely on it to work. After that, install the <strong>linter-jshint</strong> plugin.</li>
+ <li>After the packages have finished installing, try loading up a JavaScript file: you'll see any issues highlighted with green (for warnings) and red (for errors) circles next to the line numbers, and a separate panel at the bottom provides line numbers, error messages, and sometimes suggested values or other fixes.</li>
+</ol>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14173/jshint-linter.png" style="display: block; margin: 0 auto;">Other popular editors have similar linting packages available. For example, see the "Plugins for text editors and IDEs"  section of the <a href="http://jshint.com/install/">JSHint install page</a>.</p>
+
+<h4 id="Other_uses" name="Other_uses">その他</h4>
+
+<p>There are other ways to use such linters; you can read about them on the <a href="http://jshint.com/install/">JSHint</a> and <a href="http://eslint.org/docs/user-guide/getting-started">ESLint</a> install pages.</p>
+
+<p>It is worth mentioning command line uses — you can install these tools as command line utilities (available via the CLI — command line interface) using npm (Node Package Manager — you'll have to install <a href="https://nodejs.org/en/">NodeJS</a> first). For example, the following command installs JSHint:</p>
+
+<pre class="brush: bash">npm install -g jshint
+</pre>
+
+<p>You can then point these tools at JavaScript files you want to lint, for example:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14171/js-hint-commandline.png" style="display: block; height: 478px; margin: 0px auto; width: 697px;">You can also use these tools with a task runner/build tool such as <a href="http://gulpjs.com/">Gulp</a> or <a href="https://webpack.github.io/">Webpack</a> to automatically lint your JavaScript during development. (see <a href="https://developer.mozilla.org/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing#Using_a_task_runner_to_automate_testing_tools">Using a task runner to automate testing tools</a> in a later article.) See <a href="http://eslint.org/docs/user-guide/integrations">ESLint integrations</a> for ESLint options; JSHint is supported out of the box by Grunt, and also has other integrations available, e.g. <a href="https://github.com/webpack/jshint-loader">JSHint loader for Webpack</a>.</p>
+
+<div class="note">
+<p><strong>注</strong>: ESLint takes a bit more setup and configuration than JSHint, but it is more powerful too.</p>
+</div>
+
+<h3 id="Browser_developer_tools" name="Browser_developer_tools">ブラウザーの開発ツール</h3>
+
+<p>Browser developer tools have many useful features for helping to debug JavaScript. For a start, the JavaScript console will report errors in your code.</p>
+
+<p>Make a local copy of our <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/broken-ajax.html">broken-ajax.html</a> example (see the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/broken-ajax.html">source code</a> also). If you look at the console, you'll see the following output:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14165/broken-ajax.png" style="display: block; height: 86px; margin: 0px auto; width: 635px;"></p>
+
+<p>The error message reads "TypeError: jsonObj is null", and the line number signified is line 37. If we look at the source code, the relevant code section is this:</p>
+
+<pre class="brush: js">function populateHeader(jsonObj) {
+ var myH1 = document.createElement('h1');
+<strong> myH1.textContent = jsonObj['squadName'];</strong>
+ header.appendChild(myH1);
+
+ ...</pre>
+
+<p>So the code falls over as soon as we try to access <code>jsonObj</code> (which as you might expect, is supposed to be a <a href="/ja/docs/Learn/JavaScript/Objects/JSON">JSON object</a>). This is supposed to be fetched from an external <code>.json</code> file using the following XMLHttpRequest call:</p>
+
+<pre class="brush: js">var requestURL = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json';
+var request = new XMLHttpRequest();
+request.open('GET', requestURL);
+request.send();
+
+<strong>var superHeroes = request.response;</strong>
+populateHeader(superHeroes);
+showHeroes(superHeroes);</pre>
+
+<p>But this fails.</p>
+
+<h4 id="The_Console_API" name="The_Console_API">コンソール API</h4>
+
+<p>You may already know what is wrong with this code, but let's explore it some more to show how you could investigate this. For a start, there is a <a href="/ja/docs/Web/API/Console">Console</a> API that allows JavaScript code to interact with the browser's JavaScript console. It has a number of features available, but the main one you'll use often is <code><a href="/ja/docs/Web/API/Console/log">console.log()</a></code>, which prints a custom message to the console.</p>
+
+<p>Try inserting the following line just below line 31 (bolded above):</p>
+
+<pre class="brush: js">console.log('Response value: ' + superHeroes);</pre>
+
+<p>Refresh the page in the browser, and you will get an output in the console like so:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14167/console-log.png" style="display: block; height: 99px; margin: 0px auto; width: 638px;"></p>
+
+<p>The <code>console.log()</code> output shows that the <code>superHeroes</code> object doesn't appear to contain anything, although note that the error message has now changed, to "TypeError: heroes is undefined". This shows that the error is intermittent, giving further evidence that this is some kind of asynchronous error. Let's fix the current error and move on — remove the <code>console.log()</code> line, and update this code block:</p>
+
+<pre class="brush: js">var superHeroes = request.response;
+populateHeader(superHeroes);
+showHeroes(superHeroes);</pre>
+
+<p>to the following:</p>
+
+<pre class="brush: js">request.onload = function() {
+ var superHeroes = request.response;
+ populateHeader(superHeroes);
+ showHeroes(superHeroes);
+}</pre>
+
+<p>This solves the asynchronous issue, by ensuring that the functions are not run and passed the <code>superHeroes</code> object until the response has finished loading and is available.</p>
+
+<p>So to summarize, anytime something is not working and a value does not appear to be what it is meant to be at some point in your code, you can use <code>console.log()</code> to print it out and see what is happening.</p>
+
+<h4 id="Using_the_JavaScript_debugger" name="Using_the_JavaScript_debugger">JavaScript デバッガーを使う</h4>
+
+<p>We have solved one problem, but we are still stuck with the error message "TypeError: heroes is undefined", reported on line 51. Let's investigate this now, using a more sophisticated feature of browser developer tools: the <a href="/ja/docs/Tools/Debugger">JavaScript debugger</a> as it is called in Firefox.</p>
+
+<div class="note">
+<p><strong>注</strong>: Similar tools are available in other browsers; the <a href="https://developers.google.com/web/tools/chrome-devtools/#sources">Sources tab</a> in Chrome, Debugger in Safari (see <a href="https://developer.apple.com/safari/tools/">Safari Web Development Tools</a>), etc.</p>
+</div>
+
+<p>In Firefox, the Debugger tab looks as follows:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14169/debugger-tab.png" style="display: block; height: 253px; margin: 0px auto; width: 800px;"></p>
+
+<ul>
+ <li>On the left, you can select the script you want to debug (in this case we have only one).</li>
+ <li>The center panel shows the code in the selected script.</li>
+ <li>The right-hand panel shows useful details pertaining to the current environment — <em>Breakpoints</em>, <em>Callstack</em> and currently active <em>Scopes</em>.</li>
+</ul>
+
+<p>The main feature of such tools is the ability to add breakpoints to code — these are points where the execution of the code stops, and at that point you can examine the environment in its current state and see what is going on.</p>
+
+<p>Let's get to work. First of all, we know that the error is being thrown at line 51. Click on line number 51 in the center panel to add a breakpoint to it (you'll see a blue arrow appear over the top of it). Now refresh the page (Cmd/Ctrl + R) — the browser will pause execution of the code at line 51. At this point, the right-hand side will update to show some very useful information.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14163/breakpoint.png" style="display: block; margin: 0 auto;"></p>
+
+<ul>
+ <li>Under <em>Breakpoints</em>, you'll see the details of the break-point you have set.</li>
+ <li>Under <em>Call Stack</em>, you'll see two entries — this is basically a list of the series of functions that were invoked to cause the current function to be invoked. At the top, we have <code>showHeroes()</code> the function we are currently in, and below we have <code>request.onload</code>, which stores the event handler function containing the call to <code>showHeroes()</code>.</li>
+ <li>Under <em>Scopes</em>, you'll see the currently active scope for the function we are looking at. We only have two — <code>showHeroes</code>, and <code>Window</code> (the global scope). Each scope can be expanded to show the values of variables inside the scope at the point that execution of the code was stopped.</li>
+</ul>
+
+<p>We can find out some very useful information in here.</p>
+
+<ol>
+ <li>Expand the <code>showHeroes</code> scope — you can see from this that the heroes variable is undefined, indicating that accessing the <code>members</code> property of <code>jsonObj</code> (first line of the function) didn't work.</li>
+ <li>You can also see that the <code>jsonObj</code> variable is storing a text string, not a JSON object.</li>
+ <li>Exploring further down the call stack, click <code>request.onload</code> in the <em>Call Stack</em> section. The view will update to show the <code>request.onload</code> function in the center panel, and its scopes in the <em>Scopes</em> section.</li>
+ <li>Now if you expand the <code>request.onload</code> scope, you'll see that the <code>superHeroes</code> variable is a text string too, not an object. This settles it — our <code><a href="/ja/docs/Web/API/XMLHttpRequest">XMLHttpRequest</a></code> call is returning the JSON as text, not JSON.</li>
+</ol>
+
+<div class="note">
+<p><strong>注</strong>: We'd like you to try fixing this problem yourself. To give you a clue, you can either <a href="/ja/docs/Web/API/XMLHttpRequest/responseType">tell the XMLHttpRequest object explicitly to return JSON format</a>, or <a href="https://developer.mozilla.org/ja/docs/Learn/JavaScript/Objects/JSON#Converting_between_objects_and_text">convert the returned text to JSON</a> after the response arrives. If you get stuck, consult our <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/fixed-ajax.html">fixed-ajax.html</a> example.</p>
+</div>
+
+<div class="note">
+<p><strong>注</strong>: The debugger tab has many other useful features that we've not discussed here, for example conditional breakpoints and watch expressions. For a lot more information, see the <a href="/ja/docs/Tools/Debugger">Debugger</a> page.</p>
+</div>
+
+<h3 id="Performance_issues" name="Performance_issues">パフォーマンスの問題</h3>
+
+<p>As your apps get more complex and you start to use more JavaScript, you may start to run into performance problems, especially when viewing apps on slower devices. Performance is a big topic, and we don't have time to cover it in detail here. Some quick tips are as follows:</p>
+
+<ul>
+ <li>To avoid loading more JavaScript than you need, bundle your scripts into a single file using a solution like <a href="http://browserify.org/">Browserify</a>. In general, reducing the number of HTTP requests is very good for performance.</li>
+ <li>Make your files even smaller by minifying them before you load them onto your production server. Minifying squashes all the code together onto a huge single line, making it take up far less file size. It is ugly, but you don't need to read it when it is finished! This is best done using a minification tool like <a href="https://github.com/mishoo/UglifyJS2">Uglify</a> (there's also an online version — see <a href="https://jscompress.com/">JSCompress.com</a>)</li>
+ <li>When using APIs, make sure you turn off the API features when they are not being used; some API calls can be really expensive on processing power. For example, when showing a video stream, make sure it is turned off when you can't see it. When tracking a device's location using repeated Geolocation calls, make sure you turn it off when the user stops using it.</li>
+ <li>Animations can be really costly for performance. A lot of JavaScript libraries provide animation capabilities programmed by JavaScript, but it is much more cost effective to do the animations via native browser features like <a href="/ja/docs/Web/CSS/CSS_Animations">CSS Animations</a> (or the nascent <a href="/ja/docs/Web/API/Web_Animations_API">Web Animations API</a>) than JavaScript. Read Brian Birtles' <a href="https://hacks.mozilla.org/2016/08/animating-like-you-just-dont-care-with-element-animate/">Animating like you just don’t care with Element.animate</a> for some really useful theory on why animation is expensive, tips on how to improve animation performance, and information on the Web Animations API.</li>
+</ul>
+
+<div class="note">
+<p><strong>注</strong>: Addy Osmani's <a href="https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/" rel="bookmark" title="Read 'Writing Fast, Memory-Efficient JavaScript'"><span class="headline">Writing Fast, Memory-Efficient JavaScript</span></a> <span class="headline">contains a lot of detail and some excellent tips for boosting JavaScript performance.</span></p>
+</div>
+
+<h2 id="Cross-browser_JavaScript_problems" name="Cross-browser_JavaScript_problems">クロスブラウザー JavaScript の問題</h2>
+
+<p>In this section, we'll look at some of the more common cross-browser JavaScript problems. We'll break this down into:</p>
+
+<ul>
+ <li>Using modern core JavaScript features</li>
+ <li>Using modern Web API features</li>
+ <li>Using bad browser sniffing code</li>
+ <li>Performance problems</li>
+</ul>
+
+<h3 id="Using_modern_JavaScriptAPI_features" name="Using_modern_JavaScriptAPI_features">モダン JavaScript/API 機能を使う</h3>
+
+<p>In the <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Older_browsers_not_supporting_modern_features">previous article</a> we described some of the ways in which HTML and CSS errors and unrecognized features can be handled due to the nature of the languages. JavaScript is not as permissive as HTML and CSS however — if the JavaScript engine encounters mistakes or unrecognized syntax, more often than not it will throw errors.</p>
+
+<p>There are a number of modern JavaScript language features defined in recent versions of the specs (<a href="/ja/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla">ECMAScript 6</a> / <a href="/ja/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_Next_support_in_Mozilla">ECMAScript Next</a>) that simply won't work in older browsers. Some of these are syntactic sugar (basically an easier, nicer way of writing what you can already do using existing features), and some offer interesting new possibilities.</p>
+
+<p>For example:</p>
+
+<ul>
+ <li><a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promises</a> are a great new feature for performing asynchronous operations and making sure those operations are complete before code that relies on their results is used for something else. As an example, the <a href="https://developer.mozilla.org/ja/docs/Web/API/GlobalFetch/fetch">Fetch API</a> (a modern equivalent to <a href="/ja/docs/Web/API/XMLHttpRequest">XMLHTTPRequest</a>) uses promises to fetch resources across the network and make sure that the response has been returned before they are used (for example, displaying an image inside an {{htmlelement("img")}} element). They are not supported in IE at all but are supported across all modern browsers.</li>
+ <li>Arrow functions provide a shorter, more convenient syntax for writing <a href="/ja/docs/Learn/JavaScript/Building_blocks/Functions#Anonymous_functions">anonymous functions</a>, which also has other advantages (see <a href="/ja/docs/Web/JavaScript/Reference/Functions/Arrow_functions">Arrow functions</a>). For a quick example, see <a href="https://mdn.github.io/learning-area/tools-testing/cross-browser-testing/javascript/arrow-function.html">arrow-function.html</a> (see the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/arrow-function.html">source code</a> also). Arrow functions are supported across all modern browsers, except for IE and Safari.</li>
+ <li>Declaring <a href="/ja/docs/Web/JavaScript/Reference/Strict_mode">strict mode</a> at the top of your JavaScript code causes it to be parsed with a stricter set of rules, meaning that more warnings and errors will be thrown, and some things will be disallowed that would otherwise be acceptable. It is arguably a good idea to use strict mode, as it makes for better, more efficient code, however it has limited/patchy support across browsers (see <a href="/ja/docs/Web/JavaScript/Reference/Strict_mode#Strict_mode_in_browsers">Strict mode in browsers</a>).</li>
+ <li><a href="/ja/docs/Web/JavaScript/Typed_arrays">Typed arrays</a> allow JavaScript code to access and manipulate raw binary data, which is necessary as browser APIs for example start to manipulate streams of raw video and audio data. These are available in IE10 and above, and all modern browsers.</li>
+</ul>
+
+<p>There are also many new APIs appearing in recent browsers, which don't work in older browsers, for example:</p>
+
+<ul>
+ <li><a href="/ja/docs/Web/API/IndexedDB_API">IndexedDB API</a>, <a href="/ja/docs/Web/API/Web_Storage_API">Web Storage API</a>, and others for storing website data on the client-side.</li>
+ <li><a href="/ja/docs/Web/API/Web_Workers_API">Web Workers API</a> for running JavaScript in a separate thread, helping to improve performance.</li>
+ <li><a href="/ja/docs/Learn/WebGL">WebGL API</a> for real 3D graphics.</li>
+ <li><a href="/ja/docs/Web/API/Web_Audio_API">Web Audio API</a> for advanced audio manipulation.</li>
+ <li><a href="/ja/docs/Web/API/WebRTC_API">WebRTC API</a> for multi-person, real-time video/audio connectivity (e.g. video conferencing).</li>
+ <li><a href="/ja/docs/Web/API/WebVR_API">WebVR API</a> for engineering virtual reality experiences in the browser (e.g. controlling a 3D view with data input from VR Hardware)</li>
+</ul>
+
+<p>There are a few strategies for handling incompatibilities between browsers relating to feature support; let's explore the most common ones.</p>
+
+<div class="note">
+<p><strong>注</strong>: These strategies do not exist in separate silos — you can, of course combine them as needed. For example, you could use feature detection to determine whether a feature is supported; if it isn't, you could then run code to load a polyfill or a library to handle the lack of support.</p>
+</div>
+
+<h4 id="Feature_detection" name="Feature_detection">機能検出</h4>
+
+<p>The idea behind feature detection is that you can run a test to determine whether a JavaScript feature is supported in the current browser, and then conditionally run code to provide an acceptable experience both in browsers that do and don't support the feature. As a quick example, the <a href="/ja/docs/Web/API/Geolocation/Using_geolocation">Geolocation API</a>  (which exposes available location data for the device the web browser is running on) has a main entry point for its use — a <code>geolocation</code> property available on the global <a href="/ja/docs/Web/API/Navigator">Navigator</a> object. Therefore, you can detect whether the browser supports geolocation or not by using something like the following:</p>
+
+<pre class="language-js"><span class="keyword token">if</span><span class="punctuation token">(</span><span class="string token">"geolocation"</span> <span class="keyword token">in</span> navigator<span class="punctuation token">)</span> <span class="punctuation token">{</span>
+ navigator<span class="punctuation token">.</span>geolocation<span class="punctuation token">.</span><span class="function token">getCurrentPosition</span><span class="punctuation token">(</span><span class="keyword token">function</span><span class="punctuation token">(</span>position<span class="punctuation token">)</span> <span class="punctuation token">{</span>
+ // show the location on a map, perhaps using the Google Maps API
+ <span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;
+}</span> <span class="keyword token">else</span> <span class="punctuation token">{</span>
+ // Give the user a choice of static maps instead perhaps
+<span class="punctuation token">}</span></pre>
+
+<p>You could also write such a test for a CSS feature, for example by testing for the existence of <em><a href="/ja/docs/Web/API/HTMLElement/style">element.style.property</a></em> (e.g. <code>paragraph.style.transform !== undefined</code>). But for both CSS and JavaScript, it is probably better to use an established feature detection library rather than writing your own all the time. Modernizr is the industry standard for feature detection tests.</p>
+
+<p>As a last point, don't confuse feature detection with <strong>browser sniffing</strong> (detecting what specific browser is accessing the site) — this is a terrible practice that should be discouraged at all costs. See {{anch("Using bad browser sniffing code")}}, later on, for more details.</p>
+
+<div class="note">
+<p><strong>注</strong>: Some features are known to be undetectable — see Modernizr's list of <a href="https://github.com/Modernizr/Modernizr/wiki/Undetectables">Undetectables</a>.</p>
+</div>
+
+<div class="note">
+<p><strong>注</strong>: Feature detection will be covered in a lot more detail in its own dedicated article, later in the module.</p>
+</div>
+
+<h4 id="Libraries" name="Libraries">ライブラリー</h4>
+
+<p>JavaScript libraries are essentially third party units of code that you can attach to your page, providing you with a wealth of ready-made functionality that can be used straight away, saving you a lot of time in the process. A lot of JavaScript libraries probably came into existence because their developer was writing a set of common utility functions to save them time when writing future projects, and decided to release them into the wild because other people might find them useful too.</p>
+
+<p>JavaScript libraries tend to come in a few main varieties (some libraries will serve more than one of these purposes):</p>
+
+<ul>
+ <li>Utility libraries: Provide a bunch of functions to make mundane tasks easier and less boring to manage. <a href="http://jquery.com/">jQuery</a> for example provides its own fully-featured selectors and DOM manipuation libraries, to allow CSS-selector type selecting of elements in JavaScript and easier DOM building. It is not so important now we have modern features like {{domxref("Document.querySelector()")}}/{{domxref("Document.querySelectorAll()")}}/{{domxref("Node")}} methods available across browsers, but it can still be useful when older browsers need supporting.</li>
+ <li>Convenience libraries: Make difficult things easier to do. For example, the <a href="/ja/docs/Learn/WebGL">WebGL API</a> is really complex and challenging to use when you write it directly, so the <a href="https://threejs.org/">Three.js</a> library (and others) is built on top of WebGL and provides a much easier API for creating common 3D objects, lighting, textures, etc. The <a href="/ja/docs/Web/API/Service_Worker_API">Service Worker API</a> is also very complex to use, so code libraries have started appearing to make common Service Worker uses-cases much easier to implement (see the <a href="https://serviceworke.rs/">Service Worker Cookbook</a> for several useful code samples).</li>
+ <li>Effects libraries: These libraries are designed to allow you to easily add special effects to your websites. This was more useful back when {{glossary("DHTML")}} was a popular buzzword, and implementing effect involved a lot of complex JavaScript, but these days browsers have a lot of built in CSS3 features and APIs to implementing effects more easily. See <a href="https://www.javascripting.com/animation/">JavaScripting.com/animation</a> for a list of libraries.</li>
+ <li>UI libraries: Provide methods for implementing complex UI features that would otherwise be challenging to implement and get working cross browser, for example <a href="http://jqueryui.com/">jQuery UI</a> and <a href="http://foundation.zurb.com/">Foundation</a>. These tend to be used as the basis of an entire site layout; it is often difficult to drop them in just for one UI feature.</li>
+ <li>Normalization libraries: Give you a simple syntax that allows you to easily complete a task without having to worry about cross browser differences. The library will manipulate appropriate APIs in the background so the functionality will work whatever the browser (in theory). For example, <a href="https://github.com/localForage/localForage">LocalForage</a> is a library for client-side data storage, which provides a simple syntax for storing and retrieving data. In the background, it uses the best API the browser has available for storing the data, whether that is <a href="/ja/docs/Web/API/IndexedDB_API">IndexedDB</a>, <a href="/ja/docs/Web/API/Web_Storage_API">Web Storage</a>, or even WebSQL (which is now deprecated, but is still supported in some older versions of Safari/IE). As another example, jQuery</li>
+</ul>
+
+<p>When choosing a library to use, make sure that it works across the set of browsers you want to support, and test your implementation thoroughly. Also make sure that the library is popular and well-supported, and isn't likely to just become obsolete next week. Talk to other developers to find out what they recommend, see how much activity and how many contributors the library has on Github (or wherever else it is stored), etc.</p>
+
+<div class="note">
+<p><strong>注</strong>: <a href="https://www.javascripting.com/">JavaScripting.com</a> gives you a good idea of just how many JavaScript libraries there are available, and can be useful for finding libraries for specific purposes.</p>
+</div>
+
+<p>Library usage at a basic level tends to consist of downloading the library's files (JavaScript, possibly some CSS or other dependencies too) and attaching them to your page (e.g. via a {{htmlelement("script")}} element), although there are normally many other usage options for such libraries, like installing them as <a href="https://bower.io/">Bower</a> components, or including them as dependencies via the <a href="https://webpack.github.io/">Webpack</a> module bundler. You will have to read the libraries' individual install pages for more information.</p>
+
+<div class="note">
+<p><strong>注</strong>: You will also come across JavaScript frameworks in your travels around the Web, like <a href="http://emberjs.com/">Ember</a> and <a href="https://angularjs.org/">Angular</a>. Whereas libraries are often usable for solving individual problems and dropping into existing sites, frameworks tend to be more along the lines of complete solutions for developing complex web applications.</p>
+</div>
+
+<h4 id="Polyfills" name="Polyfills">Polyfills</h4>
+
+<p>Polyfills also consist of 3rd party JavaScript files that you can drop into your project, but they differ from libraries — whereas libraries tend to enhance existing functionality and make things easier, polyfills provide functionality that doesn't exist at all. Polyfills use JavaScript or other technologies entirely to build in support for a feature that a browser doesn't support natively. For example, you might use a polyfill like <a href="https://github.com/stefanpenner/es6-promise">es6-promise</a> to make promises work in browsers where they are not supported natively.</p>
+
+<p class="gh-header-title instapaper_title">Modernizr's list of <a href="https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills">HTML5 Cross Browser Polyfills</a> is a useful place to find polyfills for different purposes. Again, you should research them before you use them — make sure they work and are maintained.</p>
+
+<p class="gh-header-title instapaper_title">Let's work through an exercise — in this example we will use a Fetch polyfill to provide support for the Fetch API in older browsers; however we also need to use the es6-promise polyfill, as Fetch makes heavy use of promises, and browsers that don't support them will still be in trouble.</p>
+
+<ol>
+ <li class="gh-header-title instapaper_title">To get started, make a local copy of our <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/fetch-polyfill.html">fetch-polyfill.html</a> example and <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/flowers.jpg">our nice image of some flowers</a> in a new directory. We are going to write code to fetch the flowers image and display it in the page.</li>
+ <li class="gh-header-title instapaper_title">Next, save copies of the <a href="https://raw.githubusercontent.com/github/fetch/master/fetch.js">Fetch polyfill</a> and the <a href="https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/es6-promise.js">es6-promises polyfill</a> in the same directory as the HTML.</li>
+ <li class="gh-header-title instapaper_title">Apply the polyfill scripts to the page using the following code — place these above the existing {{htmlelement("script")}} element so they will be available on the page already when we start trying to use Fetch:
+ <pre class="brush: js">&lt;script src="es6-promise.js"&gt;&lt;/script&gt;
+&lt;script src="fetch.js"&gt;&lt;/script&gt;</pre>
+ </li>
+ <li>Inside the original {{htmlelement("script")}}, add the following code:</li>
+ <li>
+ <pre class="brush: js">var myImage = document.querySelector('.my-image');
+
+fetch('flowers.jpg').then(function(response) {
+ response.blob().then(function(myBlob) {
+ var objectURL = URL.createObjectURL(myBlob);
+ myImage.src = objectURL;
+ });
+});</pre>
+ </li>
+ <li>Now if you load it in a browser that doesn't support Fetch (Safari and IE are obvious candidates), you should still see the flower image appear — cool! <br>
+ <img alt="" src="https://mdn.mozillademos.org/files/14183/fetch-image.jpg" style="border-style: solid; border-width: 1px; display: block; margin: 0px auto;"></li>
+</ol>
+
+<div class="note">
+<p><strong>注</strong>: You can find our finished version at <a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/javascript/fetch-polyfill-finished.html">fetch-polyfill-finished.html</a> (see also the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/fetch-polyfill-finished.html">source code</a>).</p>
+</div>
+
+<div class="note">
+<p class="gh-header-title instapaper_title"><strong>注</strong>: Again, there are many different ways to make use of the different polyfills you will encounter — consult each polyfill's individual documentation.</p>
+</div>
+
+<p>One thing you might be thinking is "why should we always load the polyfill code, even if we don't need it?" This is a good point — as your sites get more complex and you start to use more libraries, polyfills, etc., you can start to load a lot of extra code, which can start to affect performance, especially on less-powerful devices. It makes sense to only load files as needed.</p>
+
+<p>Doing this requires some extra setup in your JavaScript. You need some kind of a feature detection test that detects whether the browser supports the feature we are trying to use:</p>
+
+<pre class="brush: js"><code class="language-js"><span class="hljs-keyword">if</span> (browserSupportsAllFeatures()) {
+ main();
+} <span class="hljs-keyword">else</span> {
+ loadScript(<span class="hljs-string">'polyfills.js'</span>, main);
+}
+
+<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(err) </span>{
+ <span class="hljs-comment">// actual app code goes in here</span>
+}</code></pre>
+
+<p>So first we run a conditional that checks whether the function <code>browserSupportsAllFeatures()</code> returns true. If it does, we run the <code>main()</code> function, which will contain all our app's code. <code>browserSupportsAllFeatures()</code> looks like this:</p>
+
+<pre class="brush: js"><code class="language-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">browserSupportsAllFeatures</span>() </span>{
+ <span class="hljs-keyword">return</span> <span class="hljs-built_in">window</span>.Promise &amp;&amp; <span class="hljs-built_in">window</span>.fetch;
+}</code></pre>
+
+<p>Here we are testing whether the <code><a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></code> object and <code><a href="/ja/docs/Web/API/GlobalFetch/fetch">fetch()</a></code> function exist in the browser. If both do, the function returns true. If the function returns <code>false</code>, then we run the code inside the second part of the conditional  — this runs a function called loadScript(), which loads the polyfills into the page, then runs <code>main()</code> after the loading has finished. <code>loadScript()</code> looks like this:</p>
+
+<pre class="brush: js"><code class="language-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">loadScript</span>(<span class="hljs-params">src, done</span>) </span>{
+ <span class="hljs-keyword">var</span> js = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">'script'</span>);
+ js.src = src;
+ js.onload = <span class="hljs-function"><span class="hljs-keyword">function</span>() </span>{
+ done();
+ };
+ js.onerror = <span class="hljs-function"><span class="hljs-keyword">function</span>() </span>{
+ done(<span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">'Failed to load script '</span> + src));
+ };
+ <span class="hljs-built_in">document</span>.head.appendChild(js);
+}</code>
+</pre>
+
+<p>This function creates a new <code>&lt;script&gt;</code> element, then sets its <code>src</code> attribute to the path we specified as the first argument (<code>'polyfills.js'</code> when we called it in the code above). When it has loaded, we run the function we specified as the second argument (<code>main()</code>). If an error occurs in the loading of the script, we still call the function, but with a custom error that we can retrieve to help debug a problem if it occurs.</p>
+
+<p>Note that polyfills.js is basically the two polyfills we are using put together into one file. We did this manually, but there are cleverer solutions that will automatically generate bundles for you — see <a href="http://browserify.org/">Browserify</a> (see <a href="https://www.sitepoint.com/getting-started-browserify/">Getting started with Browserify</a> for a basic tutorial). It is a good idea to bundle JS files into one like this — reducing the number of HTTP requests you need to make improves the performance of your site.</p>
+
+<p>You can see this code in action in <a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/javascript/fetch-polyfill-only-when-needed.html">fetch-polyfill-only-when-needed.html</a> (see the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/fetch-polyfill-only-when-needed.html">source code also</a>). We'd like to make it clear that we can't take credit for this code — it was originally written by Philip Walton.  Check out his article <a href="https://philipwalton.com/articles/loading-polyfills-only-when-needed/">Loading Polyfills Only When Needed</a> for the original code, plus a lot of useful explanation around the wider subject).</p>
+
+<div class="note">
+<p><strong>注</strong>: There are some 3rd party options to consider, for example <a href="https://polyfill.io/v2/docs/">Polyfill.io</a> — this is a meta-polyfill library that will look at each browser's capabilities and apply polyfills as needed, depending on what APIs and JS features you are using in your code.</p>
+</div>
+
+<h4 id="JavaScript_transpiling" name="JavaScript_transpiling">JavaScript トランスパイルする</h4>
+
+<p>Another option that is becoming popular for people that want to use modern JavaScript features now is converting code that makes use of ECMAScript 6/ECMAScript 2015 features to a version that will work in older browsers.</p>
+
+<div class="note">
+<p><strong>注</strong>: This is called "transpiling" — you are not compiling code into a lower level for to be run on a computer (like you would say with C code); instead, you are changing it into a syntax that exists at a similar level of abstraction so it can be used in the same way, but in slightly different circumstances (in this case, transforming one flavor of JavaScript into another).</p>
+</div>
+
+<p>So for example, we talked about arrow functions (see <a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/javascript/arrow-function.html">arrow-function.html</a> live, and see the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/javascript/arrow-function.html">source code</a>) earlier in the article, which only work in the newest browsers:</p>
+
+<pre class="brush: js">() =&gt; { ... }</pre>
+
+<p>We could transpile this across to a traditional old-fashioned anonymous function, so it would work in older browsers:</p>
+
+<pre class="brush: js">function() { ... }</pre>
+
+<p>The recommended tool for JavaScript transpiling is currently <a href="https://babeljs.io/">Babel</a>. This offers transpilation capabilities for language features that are appropriate for transpilation. For features that can't just be easily transpiled into an older equivalent, Babel also offers polyfills to provide support.</p>
+
+<p>The easiest way to give Babel a try is to use the <a href="https://babeljs.io/repl/">online version</a>, which allows you to enter your source code on the left, and outputs a transpiled version on the right.</p>
+
+<div class="note">
+<p><strong>注</strong>: There are many ways to use Babel (task runners, automation tools, etc.), as you'll see on the <a href="https://babeljs.io/docs/setup/">setup page</a>.</p>
+</div>
+
+<h3 id="Using_bad_browser_sniffing_code" name="Using_bad_browser_sniffing_code">悪いブラウザーを検出するコードを使う</h3>
+
+<p>All browsers have a <strong>user-agent</strong> string, which identifies what the browser is (version, name, OS, etc.) In the bad only days when pretty much everyone used Netscape or Internet Explorer, developers used to use so-called <strong>browser sniffing code</strong> to detect which browser the user was using, and give them appropriate code to work on that browser.</p>
+
+<p>The code used to look something like this (although this is a simplified example):</p>
+
+<pre class="brush: js">var ua = navigator.userAgent;
+
+if(ua.indexOf('Firefox') !== -1) {
+ // run Firefox-specific code
+} else if(ua.indexOf('Chrome') !== -1) {
+ // run Chrome-specific code
+}</pre>
+
+<p>The idea was fairly good — detect what browser is viewing the site, and run code as appropriate to make sure the browser will be able to use your site OK.</p>
+
+<div class="note">
+<p><strong>注</strong>: Try opening up your JavaScript console now and running navigator.userAgent, to see what you get returned.</p>
+</div>
+
+<p>However, as time went on, developers started to see major problems with this approach. For a start, the code was error prone. What if you knew a feature didn't work in say, Firefox 10 and below, and implemented code to detect this, and then Firefox 11 came out — which did support that feature? Firefox 11 probably wouldn't be supported because it's not Firefox 10. You'd have to change all your sniffing code regularly.</p>
+
+<p>Many developers implemented bad browser sniffing code and didn't maintain it, and browsers start getting locked out of using websites containing features that they had since implemented. This became so common that browsers started to lie about what browser they were in their user-agent strings (or claim they were all browsers), to get around sniffing code. Browsers also implemented facilities to allow users to change what user-agent string the browser reported when queried with JavaScript. This all made browser sniffing even more error prone, and ultimately pointless. </p>
+
+<div class="note">
+<p><strong>注</strong>: You should read <a href="http://webaim.org/blog/user-agent-string-history/">History of the browser user-agent string</a> by Aaron Andersen for a useful and amusing take on this situation.</p>
+</div>
+
+<p>The lesson to be learned here is — NEVER use browser sniffing. The only really use case for browser sniffing code in the modern day is if you are implementing a fix for a bug in a very specific version of a particular browser. But even then, most bugs get fixed pretty quickly in browser vendor rapid release cycles. It won't come up very often. {{anch("Feature detection")}} is almost always a better option — if you detect whether a feature is supported, you won't need to change your code when new browser versions come out, and the tests are much more reliable.</p>
+
+<p>If you come across browser sniffing when joining an existing project, look at whether it can be replaced with something more sensible. Browser sniffing causes all kind of interesting bugs, like {{bug(1308462)}}.</p>
+
+<h3 id="Handling_JavaScript_prefixes" name="Handling_JavaScript_prefixes">JavaScript プレフィックスを扱う</h3>
+
+<p>In the previous article, we included quite a lot of discussion about <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Handling_CSS_prefixes">handing CSS prefixes</a>. Well, new JavaScript implementations sometimes use prefixes too, although JavaScript uses camel case rather than hyphenation like CSS. For example, if a prefix was being used on a new shint API object called <code>Object</code>:</p>
+
+<ul>
+ <li>Mozilla would use <code>mozObject</code></li>
+ <li>Chrome/Opera/Safari would use <code>webkitObject</code></li>
+ <li>Microsoft would use <code>msObject</code></li>
+</ul>
+
+<p>Here's an example, taken from our <a href="http://mdn.github.io/violent-theremin/">violent-theremin demo</a> (see <a href="https://github.com/mdn/violent-theremin">source code</a>), which uses a combination of the <a href="/ja/docs/Web/API/Canvas_API">Canvas API</a> and the <a href="/ja/docs/Web/API/Web_Audio_API">Web Audio API</a> to create a fun (and noisy) drawing tool:</p>
+
+<pre class="brush: js">var AudioContext = window.AudioContext || window.webkitAudioContext;
+var audioCtx = new AudioContext();</pre>
+
+<p>In the case of the Web Audio API, the key entry points to using the API were supported in Chrome/Opera via <code>webkit</code> prefixed versions (they now support the unprefixed versions). The easy way to get around this situation is to create a new version of the objects that are prefixed in some browsers, and make it equal to the non-prefixed version, OR the prefixed version (OR any other prefixed versions that need consideration) — whichever one is supported by the browser currently viewing the site will be used.</p>
+
+<p>Then we use that object to manipulate the API, rather than the original one. In this case we are creating a modified <a href="/ja/docs/Web/API/AudioContext">AudioContext</a> constructor, then creating a new audio context instance to use for our Web Audio coding.</p>
+
+<p>This pattern can be applied to just about any prefixed JavaScript feature. JavaScript libraries/polyfills also make use of this kind of code, to abstract browser differences away from the developer as much as possible.</p>
+
+<p>Again, prefixed features were never supposed to be used in production websites — they are subject to change or removal without warning, and cause cross browser issues. If you insist on using prefixed features, make sure you use the right ones. You can look up what browsers require prefixes for different JavaScript/API features on MDN reference pages, and sites like <a href="http://caniuse.com/">caniuse.com</a>. If you are unsure, you can also find out by doing some testing directly in browsers.</p>
+
+<p>For example, try going into your browser's developer console and start typing</p>
+
+<pre class="brush: js">window.AudioContext</pre>
+
+<p>If this feature is supported in your browser, it will autocomplete.</p>
+
+<h2 id="Finding_help" name="Finding_help">helpを見つける</h2>
+
+<p>There are many other issues you'll encounter with JavaScript; the most important thing to know really is how to find answers online. Consult the HTML and CSS article's <a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS#Finding_help">Finding help section</a> for our best advice.</p>
+
+<h2 id="Summary" name="Summary">まとめ</h2>
+
+<p>So that's JavaScript. Simple huh? Maybe not so simple, but this article should at least give you a start, and some ideas on how to tackle the JavaScript-related problems you will come across.</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS","Learn/Tools_and_testing/Cross_browser_testing/Accessibility", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+<p> </p>
+
+<h2 id="In_this_module" name="In_this_module">このモジュール内</h2>
+
+<ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">Introduction to cross browser testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">Strategies for carrying out testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">Handling common HTML and CSS problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">Handling common JavaScript problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">Handling common accessibility problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">Implementing feature detection</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">Introduction to automated testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">Setting up your own test automation environment</a></li>
+</ul>
+
+<p> </p>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/testing_strategies/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/testing_strategies/index.html
new file mode 100644
index 0000000000..297d46d56f
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/testing_strategies/index.html
@@ -0,0 +1,372 @@
+---
+title: テスト実行のための戦略
+slug: Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies
+tags:
+ - Article
+ - Automation
+ - Beginner
+ - CodingScripting
+ - Learn
+ - Testing
+ - concepts
+ - cross browser
+ - device lab
+ - user testing
+ - virtual machine
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Introduction","Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">この記事では「(クロス)ブラウザーテストとは何?」「最もよくある問題は何?」「問題をテスト、特定、修正する主な手法は何?」といった質問に答えることで、(クロス)ブラウザーテストの概観を与えることから始めます。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td><a href="/ja/docs/Learn/HTML">HTML</a>, <a href="/ja/docs/Learn/CSS">CSS</a>, <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語に通じていること; 高レベルの<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">クロスブラウザーテストの原理</a>の理解。</td>
+ </tr>
+ <tr>
+ <th scope="row">目的:</th>
+ <td>クロスブラウザーテストに含まれる高レベルのコンセプトの理解。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Gotta_test_em_all" name="Gotta_test_'em_all">全部がテスト済み?</h2>
+
+<p>クロスブラウザーテストを実行するとき、ブラウザーのリストを作成する必要があります。ユーザーがあなたのサイトを見る可能性のあるすべてのブラウザーとデバイスの組み合わせをテストする方法はありません — 単に多スすぎるし、新しいものが常に出てきます。</p>
+
+<p>その代わりに、最も重要なターゲットブラウザー/デバイスを明確にし、それに対して最大限のサポートを広げていくよう守備的にコーディングします。</p>
+
+<p>守備的にコーディングするとは、ブラウザーで機能やスタイルが動作しない場合に、フォールバックを作るようにすることで、サイトが多少面白みが薄れても受容できるユーザー体験までダウングレードできる — 例えば見た目のすばらしさが失われても、核となる情報にアクセスできることです。</p>
+
+<p>このねらいは、テスト時に参照できるブラウザー/デバイスの図を作ることです。できるだけ簡単にすることも、できるだけ複雑にすることも、お好みに合わせてできます — 例えば、よくある手法はサポートレベルを次のように複数のグレードに分けることです:</p>
+
+<ol>
+ <li>A グレード: よくある/モダンなブラウザー — 能力のあると知られている。徹底的にテストしてフルサポートを提供する。</li>
+ <li>B グレード: 古い/機能が多くないブラウザー — 能力がないと知られている。基本的な体験をテスト/提供するが、主要な情報やサービスにはするアクセスできるようにする。</li>
+ <li>C グレード: まれな/未知のブラウザー — テストしないが、アクセスを想定する。フルサイトを提供し、少なくとも守備的なコーディングによるフォールバックは動作するようにする。</li>
+</ol>
+
+<p>下記のセクションを通じて、このフォーマットでサポート図を作ります。</p>
+
+<div class="note">
+<p><strong>注</strong>: Yahoo は最初にこの手法を、<a href="https://github.com/yui/yui3/wiki/Graded-Browser-Support">Graded browser Support</a> アプローチとして広めました。</p>
+</div>
+
+<h3 id="Educated_guesses" name="Educated_guesses">経験則</h3>
+
+<p>これを "仮定"や"感情"と呼ぶかもしれません。これは正確な科学的手法ではありませんが、もウェブ産業の経験のある人にとっては、テストすべきブラウザーについてよくわかるでしょう。サポート図のよい基本となりえます。</p>
+
+<p>例えば、西ヨーロッパや北アメリカに住んでいる場合、多くが Windows と Mac のデスクトップ/ノートPCを使っていて、主なブラウザーはChrome, Firefox, Safari, IE, Edge です。このブラウザーは定期的な更新があるため、おそらく最初の3つの最新版だけをテストしたいでしょう。Edge と IE では、いくつかの最新バージョンをテストしたくなるでしょう; これらはすべて A グレード区分にすべきでしょう.</p>
+
+<div class="note">
+<p><strong>注</strong>: You can only have one version of IE or Edge installed on a machine at once, so you will probably have to use virtual machine, or other strategy to do the testing you need. See {{anch("Virtual machines")}} later on.</p>
+</div>
+
+<p>多くの人が iOS と Android を使っているので、iOS Safari の最新版、古い Android 内蔵ブラウザーの最新版いくつか、iOS と Android 用の Chrome と Firefox もテストしたくなるでしょう。これらをスマフォとタブレットの両方でテストし、レスポンシブデザインの動作が問題ないのを確認するのが理想でしょう。</p>
+
+<p>それなりの数の人がまだ IE 9 を使っていることも知っているかもしれません。これは古くて能力もないので、B グレード区分に区分しましょう。</p>
+
+<p>ここまでで以下のサポート図ができました:</p>
+
+<ol>
+ <li>A グレード: Windows/Mac 用の Chrome と Firefox、Mac 用の Safari、Windows 用の Edge と IE (それぞれ最新の2バージョン)、iPhone/iPad 用の iOS Safari、スマフォ/タブレット用の Android 内蔵ブラウザー (最新2バージョン)、スマフォ/タブレット用の Chrome と Firefox(最新2バージョン)。</li>
+ <li>B グレード: Windows 用 IE 9</li>
+ <li>C グレード: n/a</li>
+</ol>
+
+<p>どこか別の場所に住んでいる場合や、どこか別の場所向けの (例 ある国やロケール)サイトを制作している場合、テストする主なブラウザーはたぶん別のものでしょう。</p>
+
+<div class="note">
+<p><strong>注</strong>: "The CEO of my company uses a Blackberry, so we'd better make sure it looks good on that" can also be a persuasive argument.</p>
+</div>
+
+<h3 id="Browser_support_stats" name="Browser_support_stats">ブラウザーサポートステータス</h3>
+
+<p>ブラウザーテスト選択で求められる、便利な対策は、ブラウザーサポートステータスです。こんなステータスを提供するサイトはたくさんあります。例えば、:</p>
+
+<ul>
+ <li><a href="https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&amp;qpcustomd=0">Netmarketshare</a></li>
+ <li><a href="http://gs.statcounter.com/">Statcounter</a></li>
+</ul>
+
+<p>これらはいずれも北米中心で、正確でないですが、幅広いトレンドの理解を得られます。</p>
+
+<p>例えば、<a href="https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&amp;qpcustomd=0">Netmarketshare</a>を見てみましょう。Opera が少しだが、使用される数が見えるので、Cグレードとしてサポート図に追加するべきでしょう。</p>
+
+<p>IE8 もある程度ありますが、古くてもはや利用できませんOpera Mini もいくらかありますが、複雑な JavaScript 実行など (詳しくは <a href="https://dev.opera.com/articles/opera-mini-and-javascript/">Opera Mini and JavaScript</a> を見てください)が利用できません。これはグレード B に追加すべきでしょう。</p>
+
+<h3 id="Using_analytics" name="Using_analytics">アクセス解析を使う</h3>
+
+<p>A much more accurate source of data, if you can get it, comes from an analytics app like <a href="https://www.google.com/analytics/">Google Analytics</a>. This is an application that will give you accurate stats on exactly what browsers people are using to browse your site. Of course, this relies on you already having a site to use it on, so it isn't much good for completely new sites.</p>
+
+<p>But an analytics history can be useful for finding support stats to influence say a new version of a company's site, or new features you are adding to an existing site. If you have these available, they are far more accurate than global browser stats like those mentioned above.</p>
+
+<p>You may also consider using open source and privacy focussed analytics platforms like <a href="http://www.openwebanalytics.com">Open Web Analytics</a> and <a href="https://matomo.org">Matomo</a>. They expect you to self-host the analytics platform. </p>
+
+<h4 id="Setting_up_Google_analytics" name="Setting_up_Google_analytics">Setting up Google analytics</h4>
+
+<ol>
+ <li>First of all, you'll need a Google account. Use this account to sign into <a href="https://www.google.com/analytics/">Google Analytics</a>.</li>
+ <li>Choose the <a href="https://analytics.google.com/analytics/web/">Google Analytics</a> (web) option, and click the <em>Sign Up</em> button.</li>
+ <li>Enter your web site/app details into the signup page. This is fairly intuitive to set up; the most important field to get right is the Website URL. This needs to be your site/app's root URL.</li>
+ <li>Once you've finished filling in everything, press the <em>Get Tracking ID</em> button, then accept the terms of service that appear.</li>
+ <li>The next page provides you with some code snippets and other instructions. For a basic website, what you need to do is copy the <em>Website tracking</em> code block and paste it into all the different pages you want to track using Google Analytics on your site. You could below your closing <code>&lt;/body&gt;</code> tag, or somewhere else appropriate that keeps it from getting muddled up with your application code.</li>
+ <li>Upload the changes to the development server, or wherever else you need your code.</li>
+</ol>
+
+<p>That's it! Your site should now be ready to start reporting analytics data.</p>
+
+<h4 id="Studying_analytics_data" name="Studying_analytics_data">Studying analytics data</h4>
+
+<p>Now you should be able to go back to the <a href="https://analytics.google.com/analytics/web">Analytics Web</a> homepage, and start looking at the data you've collected about your site (you need to leave a little bit of time for some data to actually be collected, of course.)</p>
+
+<p>既定では, you should see the reporting tab, like so:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14081/analytics-reporting.png" style="border-style: solid; border-width: 1px; display: block; height: 386px; margin: 0px auto; width: 700px;"></p>
+
+<p>There is a huge amount of data you could look at using Google Analytics — customized reports in different categories, etc. — and we haven't got time to discuss it all. <a href="https://support.google.com/analytics/answer/1008015">Getting started with Analytics</a> provides some useful guidance on reporting (and more) for beginners.</p>
+
+<p>You should also be encouraged to look at the different options on the left hand side, and see what kinds of data you can find out. 例えば、you can find out what browsers and operating systems your users are using by selecting <em>Audience &gt; Technology &gt; Browser &amp; OS</em> from the left hand menu.</p>
+
+<div class="note">
+<p><strong>注</strong>: When using Google analytics, you need to beware of misleading bias, e.g. "We  have no Firefox Mobile users" might lead you to not bother supporting Firefox mobile. But you are not going to have any Firefox Mobile users if the site was broken on Firefox mobile in the first place.</p>
+</div>
+
+<h3 id="Other_considerations" name="Other_considerations">その他の考慮</h3>
+
+<p>There are other considerations that you should probably include as well. You should definitely include accessibility as a grade A testing requirement (we'll cover exactly what you should test in our Handling common accessibility problems article)</p>
+
+<p>Plus you might have other considerations. If you are creating some kind of company intranet for delivering sales figures to managers, and all the managers have been provided with Windows phones 例えば、you might want to make mobile IE support a priority.</p>
+
+<h3 id="Final_support_chart" name="Final_support_chart">最終的なサポート図</h3>
+
+<p>So, our final support chart will end up looking like so:</p>
+
+<ol>
+ <li>A grade: Chrome and Firefox for Windows/Mac, Safari for Mac, Edge and IE for Windows (last two versions of each), iOS Safari for iPhone/iPad, Android stock browser (last two versions) on phone/tablet, Chrome and Firefox for Android (last two versions) on phone tablet. Accessibility passing common tests.</li>
+ <li>B grade: IE 8 and 9 for Windows, Opera Mini.</li>
+ <li>C grade: Opera, other niche modern browsers.</li>
+</ol>
+
+<h2 id="What_are_you_going_to_test" name="What_are_you_going_to_test">これから何をテストしていくのか?</h2>
+
+<p>When you've got a new addition to your codebase that needs testing, before you start testing you should write out a list of testing requirements that need to pass to be accepted. These requirements can be visual or functional — both combine to make a usable web site feature.</p>
+
+<p>Consider the following example (see the <a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/strategies/hidden-info-panel.html">source code</a>, and also the <a href="http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/strategies/hidden-info-panel.html">example running live</a>):</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14083/sliding-box-demo.png" style="border-style: solid; border-width: 1px; display: block; height: 455px; margin: 0px auto; width: 700px;"></p>
+
+<p>Test criteria for this feature could written like so:</p>
+
+<p>A and B grade:</p>
+
+<ul>
+ <li>Button should be activatable by the user's primary control mechanism, whatever it is — this should include mouse, keyboard, and touch.</li>
+ <li>Toggling the button should make the information box appear/disappear.</li>
+ <li>The text should be readable.</li>
+ <li>Visually impaired users using screenreaders should be able to access the text.</li>
+</ul>
+
+<p>A grade:</p>
+
+<ul>
+ <li>The information box should animate smoothly as it appears/disappears.</li>
+ <li>The gradient and text shadow should appear to enhance the look of the box.</li>
+</ul>
+
+<p>You may notice from the text in the example that it won't work in IE8 — this is a problem according to our support chart, which you'll have to work on, perhaps by using a feature detection library to implement the functionality in a different way if the browser doesn't support CSS transitions (see Implementing feature detection, later on in the course).</p>
+
+<p>You might also notice that the button isn't usable using only the keyboard — this also needs to be remedied. Maybe we could use some JavaScript to implement a keyboard control for the toggle, or use some other method entirely?</p>
+
+<p>These test criteria are useful, because:</p>
+
+<ul>
+ <li>They give you a set of steps to follow when you are performing tests.</li>
+ <li>They can be easily turned into sets of instructions for user groups to follow when carrying out tests (e.g. "try to active the button using your mouse, and then the keyboard...") — see {{anch("User testing")}}, below.</li>
+ <li>They can also provide a basis for writing automated tests. It is easier to write such tests if you know exactly what you want to test, and what the success conditions are (see Using an automation tool to automate browser testing, later in the series).</li>
+</ul>
+
+<h2 id="Putting_together_a_testing_lab" name="Putting_together_a_testing_lab">Putting together a testing lab</h2>
+
+<p>One option for carrying out browser tests is to do the testing yourself. To do this, you will probably use a combination of actual physical devices, and emulated environments (using either an emulator or a virtual machine).</p>
+
+<h3 id="Physical_devices" name="Physical_devices">物理デバイス</h3>
+
+<p>It is generally better to have a real device running the browser you want to test — this provides the greatest accuracy in terms of behaviour and overall user experience. You'll probably want something like the following, for a reasonable low level device lab:</p>
+
+<ul>
+ <li>A Mac, with the browsers installed that you need to test — this can include Firefox, Chrome, Opera, and Safari.</li>
+ <li>A Windows PC, with the browsers installed that you need to test — this can include Edge (or IE), Chrome, Firefox, and Opera.</li>
+ <li>A higher spec Android phone and tablet with browser installed that you need to test — this can include Chrome, Firefox, and Opera Mini for Android, as well as the original Android stock browser.</li>
+ <li>A higher spec iOS phone and tablet with the browsers installed that you need to test — this can include iOS Safari, and Chrome, Firefox, and Opera Mini for iOS.</li>
+</ul>
+
+<p>The following are also good options, if you can get them:</p>
+
+<ul>
+ <li>A Linux PC available, in case you need to test bugs specific to Linux versions of browsers. Linux users comonly use Firefox, Opera, and Chrome. If you only have one machine available, you could consider creating a dual boot machine running Linux and Windows on separate partitions. Ubuntu's installer makes this quite easy to set up; see <a href="https://help.ubuntu.com/community/WindowsDualBoot">WindowsDualBoot</a> for help with this.</li>
+ <li>A couple of lower spec mobile devices, so you can test performance of features like animations on lower powered processors.</li>
+</ul>
+
+<p>Your main work machine can also be a place to install other tools for specific purposes, such as accessibility auditing tools, screen readers, and emulators/virtual machines.</p>
+
+<p>Some larger companies have device labs that stock a very large selection of different devices, enabling developers to hunt down bugs on very specific browser/device combinations. Smaller companies and individuals are generally not able to afford such a sophisticated lab, so tend to make do with smaller labs, emulators, virtual machines, and commercial testing apps.</p>
+
+<p>We will cover each of the other options below.</p>
+
+<div class="note">
+<p><strong>注</strong>: Some efforts have been made to create publically accessible device labs — see <a href="https://opendevicelab.com/">Open Device Labs</a>.</p>
+</div>
+
+<div class="note">
+<p><strong>注</strong>: We also need to consider accessibility — there are a number of useful tools you can install on your machine to facilitate accessibility testing, but we'll cover those in the Handling common accessibility problems article, later in the course.</p>
+</div>
+
+<h3 id="Emulators" name="Emulators">エミュレーター</h3>
+
+<p>Emulators are basically programs that run inside your computer and emulate a device or particular device conditions of some kind, allowing you to do some of your testing more conveniently than having to find a particular combination of hardware/software to test.</p>
+
+<p>An emulator might be as simple as testing a device condition. 例えば、if you want to do some quick and dirty testing of your width/height media queries for responsive design, you could use Firefox's <a href="/ja/docs/Tools/Responsive_Design_Mode">Responsive Design Mode</a>. Safari has a similar mode too, which can be enabled by going to <em>Safari &gt; Preferences</em>, and checking <em>Show Develop menu</em>, then choosing <em>Develop &gt; Enter Responsive Design Mode</em>. Chrome also has something similar: Device mode (see <a href="https://developers.google.com/web/tools/chrome-devtools/device-mode/">Simulate Mobile Devices with Device Mode</a>). </p>
+
+<p>More often than not though, you'll have to install some kind of emulator. The most common devices/browsers you'll want to test are as follows:</p>
+
+<ul>
+ <li>The official <a href="https://developer.android.com/studio/">Android Studio IDE</a> for developing Android apps is a bit heavy weight for just testing websites on Google Chrome or the old Stock Android browser, but it does come with a Robust <a href="https://developer.android.com/studio/run/emulator.html">emulator</a>. If you want something a bit more lightweight, <a href="http://leapdroid.com/">LeapDroid</a> is a good option for Windows, and <a href="http://www.andyroid.net/">Andy</a> is a reasonable option that runs on both Windows and Mac.</li>
+ <li>Apple provides an app called <a href="https://developer.apple.com/library/content/documentation/IDEs/Conceptual/iOS_Simulator_Guide/Introduction/Introduction.html">Simulator</a> that runs on top of the <a href="https://developer.apple.com/xcode/">XCode</a> development environment, and emulates iPad/iPhone/Apple Watch/Apple TV. This includes the native iOS Safari browser. This unfortunately only runs on a Mac.</li>
+</ul>
+
+<p>You can often find simulators for other mobile device environments too, 例えば、:</p>
+
+<ul>
+ <li><a href="https://developer.blackberry.com/develop/simulator/">Blackberry</a> (emulator available for Windows, Mac OSX and Linux).</li>
+ <li>You can emulate <a href="https://dev.opera.com/articles/installing-opera-mini-on-your-computer/">Opera Mini</a> on its own if you want to test it.</li>
+ <li>There are emulators available for Windows Mobile OSes: see <a href="https://msdn.microsoft.com/en-us/library/windows/apps/ff402563(v=vs.105).aspx">Windows Phone Emulator for Windows Phone 8</a> and <a href="https://msdn.microsoft.com/en-us/windows/uwp/debug-test-perf/test-with-the-emulator">Test with the Microsoft Emulator for Windows 10 Mobile</a> (these only run on Windows).</li>
+</ul>
+
+<div class="note">
+<p><strong>注</strong>: Many emulators actually require the use of a virtual machine (see below); when this is the case, instructions are often provided, and/or use of the virtual machine is incorporated into the installer of the emulator.</p>
+</div>
+
+<h3 id="Virtual_machines" name="Virtual_machines">仮想マシン</h3>
+
+<p>Virtual machines are applications that run on your desktop computer and allow you to run emulations of entire operating systems, each compartmentalized in its own virtual hard drive (often represented by a single large file existing on the host machine's hard drive). There are a number of popular virtual machine apps available, such as <a href="www.parallels.com/">Parallels</a>, <a href="http://www.vmware.com/">VMWare</a>, and <a href="https://www.virtualbox.org/wiki/Downloads">Virtual Box</a>; we personally like the latter, because it is free.</p>
+
+<div class="note">
+<p><strong>注</strong>: You need a lot of hard disk space available to run virtual machine emulations; each operating system you emulate can take up a lot of memory. You tend to choose the hard drive space you want for each install; you could get away with probably 10GB, but some sources recommend up to 50GB or more, so the operating system will run reliably. A good option provided by most virtual machine apps is to create a <strong>dynamically allocated</strong> hard drive that grows and shrinks as the need arises.</p>
+</div>
+
+<p>To use a Virtual Box, you need to:</p>
+
+<ol>
+ <li>Get hold of an installer disk or image (e.g. ISO file) for the operating system you want to emulate. Virtual Box is unable to provide these; most, like Windows OSes, are commercial products that can't be freely distributed.</li>
+ <li><a href="https://www.virtualbox.org/wiki/Downloads">Download the appropriate installer</a> for your operating system and install it.</li>
+ <li>Open the app; you'll be presented with a view like the following: <img alt="" src="https://mdn.mozillademos.org/files/14089/virtualbox.png" style="display: block; height: 512px; margin: 0px auto; width: 700px;"></li>
+ <li>To create a new virtual machine, press the <em>New</em> button in the top left hand corner.</li>
+ <li>Follow the instructions and fill in the following dialog boxes as appropriate. You'll:
+ <ol>
+ <li>Provide a name for the new virtual machine</li>
+ <li>Choose with operating system and version you are installing on it</li>
+ <li>Set how much RAM should be allocated (we'd recommend something like 2048MB, or 2GB)</li>
+ <li>Create a virtual hard disk (choose the default options across the three dialog boxes containing <em>Create a virtual hard disk now</em>, <em>VDI (virtual disk image)</em>, and <em>Dynamically allocated</em>).</li>
+ <li>Choose the file location and size for the virtual hard disk (choose a sensible name and location to keep it, and for the size specify around 50GB, or as much as you are comfortable with specifying).</li>
+ </ol>
+ </li>
+</ol>
+
+<p>Now the new virtual box should appear in the left hand menu of the main Virtual Box UI window. At this point, you can double-click to open it — it will start to boot up the virtual machine, but it won't yet have the operating system (OS) installed. At this point you need to point the dialog box at the installer image/disk, and it will run through the steps to install the OS just like on a physical machine.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14085/virtualbox-installer.png" style="display: block; margin: 0 auto;"></p>
+
+<div class="warning">
+<p><strong>Important</strong>: You need to make sure you have the operating system image you want to install on the virtual machine available at this point, and install it right away. If you cancel the process at this point, it can render the virtual machine unusable, and make it so you need to delete it and create it again. This is not fatal, but it is annoying.</p>
+</div>
+
+<p>After the process has completed, you should have a virtual machine running an operating system inside a window on your host computer.</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14087/virtualbox-running.png" style="display: block; margin: 0 auto;"></p>
+
+<p>You need to treat this virtual operating system installation just like you would any real installation — 例えば、as well as installing the browsers you want to test, install an anti-virus program to protect it from viruses.</p>
+
+<p>Having multiple virtual machines is very useful, particularly for Windows IE/Edge testing — on Windows, you are not able to have multiple versions of the default browser installed side by side, so you might want to build up a library of virtual machines to handle different tests as required, e.g.:</p>
+
+<ul>
+ <li>Windows 10 with Edge 14</li>
+ <li>Windows 10 with Edge 13</li>
+ <li>Windows 8.1 with IE11</li>
+ <li>Windows 8 with IE10</li>
+ <li>Windows 7 with IE9</li>
+ <li>Windows XP with IE8</li>
+ <li>Windows XP with IE7</li>
+ <li>Windows XP with IE6</li>
+</ul>
+
+<div class="note">
+<p><strong>注</strong>: Another good thing about virtual machines is that the virtual disk images are fairly self-contained. If you are working on a team, you can create one virtual disk image, then copy it and pass it around. Just make sure you have the required licenses to run all those copies of Windows or whatever else you are running, if it is a licensed product.</p>
+</div>
+
+<h3 id="Automation_and_commercial_apps" name="Automation_and_commercial_apps">自動化と商用アプリ</h3>
+
+<p>As mentioned in the last chapter, you can take a lot of the pain out of browser testing by using some kind of automation system. You can set up your own testing automation system (<a href="http://www.seleniumhq.org/">Selenium</a> being the popular app of choice), which does take some setup, but can be very rewarding when you get it worked out.</p>
+
+<p>There are also commercial tools available such as <a href="https://saucelabs.com/">Sauce Labs</a> and <a href="https://www.browserstack.com/">Browser Stack</a> that do this kind of thing for you, without you having to worry about the setup, if you wish to invest some money in your testing.</p>
+
+<p>We will look at how to use such tools later on in the module.</p>
+
+<h2 id="User_testing" name="User_testing">ユーザーテスト</h2>
+
+<p>Before we move on, we'll finish this article off by talking a bit about user testing — this can be a good option if you have a willing user group to test your new functionality on. Bear in mind that this can be as lo-fi or as sophisticated as you like — your user group could be a group of friends, a group of colleagues, or a group of unpaid or paid volunteers, depending on whether you have any money to spend on testing.</p>
+
+<p>Generally you'll get your users to look at the page or view containing the new functionality on some kind of a development server, so you are not putting the final site or change live until it is finished. You should get them to follow some steps and report the results they get. It is useful to provide a set of steps (sometimes called a script) so that you get more reliable results pertaining to what you were trying to test. We mentioned this in the {{anch("What are you going to test")}} section above — it is easy to turn the test criteria detailed there into steps to follow. 例えば、the following would work for a sighted user:</p>
+
+<ul>
+ <li>Click the question mark button using the mouse on your desktop computer a few times. Refresh the browser window.</li>
+ <li>Select and activate the question mark button using the keyboard on your desktop computer a few times.</li>
+ <li>Tap the question mark button a few times on your touch screen device.</li>
+ <li>Toggling the button should make the information box appear/disappear. Does it do this, in each of the above three cases?</li>
+ <li>Is the text readable?</li>
+ <li>Does the information box animate smoothly as it appears/disappears?</li>
+</ul>
+
+<p>When running tests, it can also be a good idea to:</p>
+
+<ul>
+ <li>Set up a separate browser profile where possible, with browser extensions and other such things disabled, and run your tests in that profile (see <a href="https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles">Use the Profile Manager to create and remove Firefox profiles</a> and <a href="https://support.google.com/chrome/answer/2364824">Share Chrome with others or add personas</a>, 例えば、).</li>
+ <li>Use browser's private mode functionality when running tests, where available (e.g. <a href="https://support.mozilla.org/en-US/kb/private-browsing-use-firefox-without-history">Private Browsing</a> in Firefox, <a href="https://support.google.com/chrome/answer/95464">Incognito Mode</a> in Chrome) so things like cookies and temp files are not saved.</li>
+</ul>
+
+<p>These steps are designed to make sure that the browser you are testing in is as "pure" as possible, i.e. there is nothing installed that could affect the results of the tests.</p>
+
+<div class="note">
+<p><strong>注</strong>: Another useful lo-fi option, if you have the hardware available, is to test your sites on low-end phones/other devices — as sites get larger and feature more effects, there is a higher chance of the site slowing down, so you need to start giving performance more consideration. Trying to get your functionality working on a low end device will make it more likely that the experience will be good on higher-end devices.</p>
+</div>
+
+<div class="note">
+<p><strong>注</strong>: Some server-side development environments provide useful mechanisms for rolling out site changes to only a subset of users, providing a useful mechanism for getting a feature tested by a subset of users without the need for a separate development server. An example is <a href="https://github.com/jsocol/django-waffle">Django Waffle Flags</a>.</p>
+</div>
+
+<h2 id="Summary" name="Summary">まとめ</h2>
+
+<p>この記事を読んで、ターゲット顧客/ブラウザーの表を特定して、その表に載っているクロスブラウザーテストを効率的に実行することが良くわかったでしょう。</p>
+
+<p>次には HTML と CSSから始めて、テストで見つけにくいコードの問題に注目していきましょう。</p>
+
+<p>{{PreviousMenuNext("Learn/Tools_and_testing/Cross_browser_testing/Introduction","Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+
+
+<h2 id="In_this_module" name="In_this_module">このモジュール内</h2>
+
+<ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">Introduction to cross browser testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">Strategies for carrying out testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">Handling common HTML and CSS problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">Handling common JavaScript problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">Handling common accessibility problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">Implementing feature detection</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">Introduction to automated testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">Setting up your own test automation environment</a></li>
+</ul>
diff --git a/files/ja/learn/tools_and_testing/cross_browser_testing/your_own_automation_environment/index.html b/files/ja/learn/tools_and_testing/cross_browser_testing/your_own_automation_environment/index.html
new file mode 100644
index 0000000000..ffdd4984a0
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/cross_browser_testing/your_own_automation_environment/index.html
@@ -0,0 +1,688 @@
+---
+title: テスト自動化環境をセットアップする
+slug: Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment
+tags:
+ - Article
+ - Automation
+ - Beginner
+ - Browser
+ - CodingScripting
+ - Learn
+ - Testing
+ - Tools
+ - cross browser
+ - selenium
+translation_of: Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment
+---
+<div>{{LearnSidebar}}</div>
+
+<div>{{PreviousMenu("Learn/Tools_and_testing/Cross_browser_testing/Automated_testing", "Learn/Tools_and_testing/Cross_browser_testing")}}</div>
+
+<p class="summary">この記事では、Selenium/WebDriver や selenium-webdriver for Node のようなテストライブラリーを使って、自動化環境のインストールとテストを実行する方法を教えます。またあなたのローカルテスト環境と、以前の記事で見てきたような商用アプリとを統合する方法についても見て行きます。</p>
+
+<table class="learn-box standard-table">
+ <tbody>
+ <tr>
+ <th scope="row">前提条件:</th>
+ <td><a href="/ja/docs/Learn/HTML">HTML</a>, <a href="/ja/docs/Learn/CSS">CSS</a>,  <a href="/ja/docs/Learn/JavaScript">JavaScript</a> のコア機能、<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">principles of cross browser testing</a>や<a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">automated testing</a>などの高レベルのアイデアに精通していること。</td>
+ </tr>
+ <tr>
+ <th scope="row">目的:</th>
+ <td>Seleniumによるローカルテスト環境のセットアップ方法やSeleniumを使用したテストの実行方法、Sauce LabsやBrowserStackなどのツールとの統合する方法の案内。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Selenium" name="Selenium">Selenium</h2>
+
+<p><a href="http://www.seleniumhq.org/">Selenium</a> は最も人気のあるブラウザ自動化ツールです。他の方法もありますが、Selenium を使用する最良の方法は WebDriver を使用することで、強力な API で Selenium 上に構築し、ブラウザを呼び出して自動化し、「このWebページを開く」、「この要素をページ上に移動する」、「このリンクをクリックする」、「リンクがこのURLを開くかどうかを確認する」などといったアクションを実行します。これは、自動テストを実行するのに最適です。<br>
+ <br>
+ WebDriverのインストール方法と使用方法は、テストの作成と実行に使用するプログラミング環境によって異なります。最も一般的な環境では、WebDriverとその言語、例えばJava、C#、Ruby、Python、JavaScript(Node)などを使用してWebDriverと通信するのに必要なバインディングをインストールするパッケージまたはフレームワークが利用可能です。異なる言語のSeleniumのセットアップの詳細については、 <a href="http://www.seleniumhq.org/docs/03_webdriver.jsp#setting-up-a-selenium-webdriver-project">Setting Up a Selenium-WebDriver Project</a> を参照してください。<br>
+ <br>
+ 異なるブラウザでは、WebDriverと通信して制御するために異なるドライバが必要です。ブラウザのドライバの入手先などについては、 <a href="http://www.seleniumhq.org/about/platforms.jsp">Platforms Supported by Selenium</a> を参照してください。<br>
+ <br>
+ Node.jsを使用したSeleniumテストの作成と実行については、始める前にすばやく簡単に行うことができ、フロントエンド開発者にはもっと使い慣れた環境を提供する予定です。</p>
+
+<div class="note">
+<p><strong>注</strong>: 他のサーバーサイド環境でWebDriverを使用する方法を知りたい場合は、<a href="http://www.seleniumhq.org/about/platforms.jsp">Platforms Supported by Selenium</a>もチェックしてください。</p>
+</div>
+
+<h3 id="Setting_up_Selenium_in_Node" name="Setting_up_Selenium_in_Node">Node で Selenium のセットアップ</h3>
+
+<ol>
+ <li>まず、最後の章の <a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing#Setting_up_Node_and_npm">Setting up Node and npm</a> で説明しているように、新しいnpmプロジェクトをセットアップします。<code>selenium-test</code>のように違うものを呼んでください。</li>
+ <li>次に私たちはNodeの内部からSeleniumが機能するようにフレームワークをインストールする必要があります。 更新頻度が高く、よく改善されるため、私たちは<a href="https://www.npmjs.com/package/selenium-webdriver">selenium-webdriver</a>を選択します。もしも他の選択をするならば<a href="http://webdriver.io/">webdriver.io</a> と <a href="http://nightwatchjs.org/">nightwatch.js</a> もいい選択です。selenium-webdriverをインストールするため, プロジェクトフォルダの下で以下のコマンドを走らせます:</li>
+ <li>
+ <pre class="brush: bash"><code>npm install selenium-webdriver</code></pre>
+ </li>
+</ol>
+
+<div class="note">
+<p><strong>注</strong>: 以前に selenium-webdriver をインストールしてブラウザドライバをダウンロードした場合でも、これらの手順を実行することをお勧めします。すべてが最新であることを確認する必要があります。</p>
+</div>
+
+<p>Next, you need to download the relevant drivers to allow WebDriver to control the browsers you want to test. You can find details of where to get them from on the <a href="https://www.npmjs.com/package/selenium-webdriver">selenium-webdriver</a> page (see the table in the first section.) Obviously, some of the browsers are OS-specific, but we're going to stick with Firefox and Chrome, as they are available across all the main OSes.</p>
+
+<ol>
+ <li>Download the latest <a href="https://github.com/mozilla/geckodriver/releases/">GeckoDriver</a> (for Firefox) and <a href="http://chromedriver.storage.googleapis.com/index.html">ChromeDriver</a> drivers.</li>
+ <li>Unpack them into somewhere fairly easy to navigate to, like the root of your home user directory.</li>
+ <li>Add the <code>chromedriver</code> and <code>geckodriver</code> driver's location to your system <code>PATH</code> variable. This should be an absolute path from the root of your hard disk, to the directory containing the drivers. 例えば、if we were using a Mac OS X machine, our user name was bob, and we put our drivers in the root of our home folder, the path would be <code>/Users/bob</code>.</li>
+</ol>
+
+<div class="note">
+<p><strong>注</strong>: Just to reiterate, the path you add to <code>PATH</code> needs to be the path to the directory containing the drivers, not the paths to the drivers themselves! This is a common mistake.</p>
+</div>
+
+<p>To set your <code>PATH</code> variable on Mac OS X/most Linux systems:</p>
+
+<ol>
+ <li>Open your <code>.bash_profile</code> (or <code>.bashrc</code>) file (if you can't see hidden files, you'll need to display them, see <a href="http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/">Show/Hide hidden files in Mac OS X</a> or <a href="http://askubuntu.com/questions/470837/how-to-show-hidden-folders-in-ubuntu-14-04">Show hidden folders in Ubuntu</a>).</li>
+ <li>Paste the following into the bottom of your file (updating the path as it actually is on your machine):
+ <pre class="brush: bash">#Add WebDriver browser drivers to PATH
+
+export PATH=$PATH:/Users/bob</pre>
+ </li>
+ <li>Save and close this file, then restart your Terminal/command prompt to reapply your Bash configuration.</li>
+ <li>Check that your new paths are in the <code>PATH</code> variable by entering the following into your terminal:
+ <pre class="brush: bash">echo $PATH</pre>
+ </li>
+ <li>You should see it printed out in the terminal.</li>
+</ol>
+
+<p>To set your <code>PATH</code> variable on Windows, follow the instructions at <a href="http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path">How can I add a new folder to my system path?</a></p>
+
+<p>OK, let's try a quick test to make sure everything is working.</p>
+
+<ol>
+ <li>Create a new file inside your project directory called <code>google_test.js</code>:</li>
+ <li>Give it the following contents, then save it:
+ <pre class="brush: js">var webdriver = require('selenium-webdriver'),
+ By = webdriver.By,
+ until = webdriver.until;
+
+var driver = new webdriver.Builder()
+ .forBrowser('firefox')
+ .build();
+
+driver.get('http://www.google.com');
+
+driver.findElement(By.name('q')).sendKeys('webdriver');
+
+driver.sleep(1000).then(function() {
+  driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB);
+});
+
+driver.findElement(By.name('btnK')).click();
+
+driver.sleep(2000).then(function() {
+ driver.getTitle().then(function(title) {
+ if(title === 'webdriver - Google Search') {
+ console.log('Test passed');
+ } else {
+ console.log('Test failed');
+ }
+ });
+});
+
+driver.quit();</pre>
+ </li>
+ <li>In terminal, make sure you are inside your project folder, then enter the following command:
+ <pre class="brush: bash">node google_test</pre>
+ </li>
+</ol>
+
+<p>You should see an instance of Firefox automatically open up! Google should automatically be loaded in a tab, "webdriver" should be entered in the search box, and the search button will be clicked. WebDriver will then wait for 2 seconds; the document title is then accessed, and if it is "webdriver - Google Search", we will return a message to claim the test is passed. WebDriver will then close down the Firefox instance and stop.</p>
+
+<h2 id="Testing_in_multiple_browsers_at_once" name="Testing_in_multiple_browsers_at_once">一度に複数ブラウザでテストする</h2>
+
+<p>There is also nothing to stop you running the test on multiple browsers simulataneously. Let's try this!</p>
+
+<ol>
+ <li>Create another new file inside your project directory called <code>google_test_multiple.js</code>. You can feel free to change the references to some of the other browsers we added, remove them, etc., depending on what browsers you have available to test on your operating system. You'll need to make sure you have the right browser drivers set up on your system. In terms of what string to use inside the <code>.forBrowser()</code> method for other browsers,  see the <a href="http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Browser.html">Browser enum</a> reference page.</li>
+ <li>Give it the following contents, then save it:
+ <pre class="brush: js">var webdriver = require('selenium-webdriver'),
+ By = webdriver.By,
+ until = webdriver.until;
+
+var driver_fx = new webdriver.Builder()
+ .forBrowser('firefox')
+ .build();
+
+var driver_chr = new webdriver.Builder()
+ .forBrowser('chrome')
+ .build();
+
+searchTest(driver_fx);
+searchTest(driver_chr);
+
+function searchTest(driver) {
+ driver.get('http://www.google.com');
+ driver.findElement(By.name('q')).sendKeys('webdriver');
+
+  driver.sleep(1000).then(function() {
+   driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB);
+ });
+
+  driver.findElement(By.name('btnK')).click();
+
+ driver.sleep(2000).then(function() {
+ driver.getTitle().then(function(title) {
+ if(title === 'webdriver - Google Search') {
+ console.log('Test passed');
+ } else {
+ console.log('Test failed');
+ }
+ });
+ });
+
+ driver.quit();
+}</pre>
+ </li>
+ <li>In terminal, make sure you are inside your project folder, then enter the following command:
+ <pre class="brush: bash">node google_test_multiple</pre>
+ </li>
+ <li>If you are using a Mac and do decide to test Safari, you might get an error message along the lines of "Could not create a session: You must enable the 'Allow Remote Automation' option in Safari's Develop menu to control Safari via WebDriver." If you get this, follow the given instruction and try again.</li>
+</ol>
+
+<p>So here we've done the test as before, except that this time we've wrapped it inside a function, <code>searchTest()</code>. We've created new browser instances for multiple browsers, then passed each one to the function so the test is performed on all three browsers!</p>
+
+<p>Fun huh? Let's move on, look at the basics of WebDriver syntax, in a bit more detail.</p>
+
+<h2 id="WebDriver_syntax_crash_course" name="WebDriver_syntax_crash_course">WebDriver 構文クラッシュコース</h2>
+
+<p>Let's have a look at a few key features of the webdriver syntax. For more complete details, you should consult the <a href="http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/">selenium-webdriver JavaScript API reference</a> for a detailed reference, and the Selenium main documentation's <a href="http://www.seleniumhq.org/docs/03_webdriver.jsp">Selenium WebDriver</a> and <a href="http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp">WebDriver: Advanced Usage</a> pages, which contain multiple examples to learn from written in different languages.</p>
+
+<h3 id="Starting_a_new_test" name="Starting_a_new_test">新しいテストを始める</h3>
+
+<p>To start up a new test, you need to include the <code>selenium-webdriver</code> module like this:</p>
+
+<pre class="brush: js">var webdriver = require('selenium-webdriver'),
+ By = webdriver.By,
+ until = webdriver.until;</pre>
+
+<p>Next, you need to create a new instance of a driver, using the <code>new webdriver.Builder()</code> constructor. This needs to have the <code>forBrowser()</code> method chained onto it to specify what browser you want to test with this builder, and the <code>build()</code> method to actually build it (see the <a href="http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Builder.html">Builder class reference</a> for detailed information on these features).</p>
+
+<pre class="brush: js">var driver = new webdriver.Builder()
+ .forBrowser('firefox')
+ .build();</pre>
+
+<p>Note that it is possible to set specific configuration options for browsers to be tested, 例えば、you can set a specific version and OS to test in the <code>forBrowser()</code> method:</p>
+
+<pre class="brush: js">var driver = new webdriver.Builder()
+ .forBrowser('firefox', '46', 'MAC')
+ .build();</pre>
+
+<p>You could also set these options using an environment variable, 例えば、:</p>
+
+<pre class="brush: bash"><code>SELENIUM_BROWSER=firefox:46:MAC</code></pre>
+
+<p>Let's create a new test to allow us to explore this code as we talk about it. Inside your selenium test project directory, create a new file called <code>quick_test.js</code>, and add the following code to it:</p>
+
+<pre class="brush: js">var webdriver = require('selenium-webdriver'),
+ By = webdriver.By,
+ until = webdriver.until;
+
+var driver = new webdriver.Builder()
+ .forBrowser('firefox')
+ .build();</pre>
+
+<h3 id="Getting_the_document_you_want_to_test" name="Getting_the_document_you_want_to_test">テストするドキュメントの取得</h3>
+
+<p>To load the page you actually want to test, you use the <code>get()</code> method of the driver instance you created earlier, 例えば、:</p>
+
+<pre class="brush: js"><span class="nx">driver</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'http://www.google.com'</span><span class="p">);</span></pre>
+
+<div class="note">
+<p><span class="p"><strong>注</strong>: See the <a href="http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebDriver.html">WebDriver class reference</a> for details of the features in this section and the ones below it.</span></p>
+</div>
+
+<p>You can use any URL to point to your resource, including a <code>file://</code> URL to test a local document:</p>
+
+<pre class="brush: js">driver.get('file:///Users/chrismills/git/learning-area/tools-testing/cross-browser-testing/accessibility/fake-div-buttons.html');</pre>
+
+<p>or</p>
+
+<pre class="brush: js">driver.get('http://localhost:8888/fake-div-buttons.html');</pre>
+
+<p>But it is better to use a remote server location so the code is more flexible — when you start using a remote server to run your tests (see later on), your code will break if you try to use local paths. </p>
+
+<p>Add this line to the bottom of <code>quick_test.js</code> now:</p>
+
+<pre class="brush: js">driver.get('http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/accessibility/native-keyboard-accessibility.html');</pre>
+
+<h3 id="Interacting_with_the_document" name="Interacting_with_the_document">文書とのやりとり</h3>
+
+<p>Now we've got a document to test, we need to interact with it in some way, which usually involves first selecting a specific element to test something about. You can <a href="http://www.seleniumhq.org/docs/03_webdriver.jsp#locating-ui-elements-webelements">select UI elements in many ways</a> in WebDriver, including by ID, class, element name, etc. The actual selection is done by the <code>findElement()</code> method, which accepts as a parameter a selection method. 例えば、to select an element by ID:</p>
+
+<pre class="brush: js"><span class="kd">var</span> <span class="nx">element</span> <span class="o">=</span> <span class="nx">driver</span><span class="p">.</span><span class="nx">findElement</span><span class="p">(</span><span class="nx">By</span><span class="p">.</span><span class="nx">id</span><span class="p">(</span><span class="s1">'myElementId'</span><span class="p">));</span></pre>
+
+<p>One of the most useful ways to find an element by CSS — the  By.css method allows you to select an element using a CSS selector</p>
+
+<p>Enter the following at the bottom of your <code>quick_test.js</code> code now:</p>
+
+<pre class="brush: js"><span class="kd">var</span> <span class="nx">button</span> <span class="o">=</span> <span class="nx">driver</span><span class="p">.</span><span class="nx">findElement</span><span class="p">(</span><span class="nx">By</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s1">'</span>button:nth-of-type(1)<span class="s1">'</span><span class="p">));</span></pre>
+
+<h3 id="Testing_your_element" name="Testing_your_element"><span class="p">要素のテスト</span></h3>
+
+<p><span class="p">There are many ways to interact with your web documents and elements on them. You can see useful common examples starting at <a href="http://www.seleniumhq.org/docs/03_webdriver.jsp#getting-text-values">Getting text values</a> on the </span>WebDriver docs.</p>
+
+<p>If we wanted to get the text inside our button, we could do this:</p>
+
+<pre class="brush: js">button.getText().then(function(text) {
+ console.log('Button text is \'' + text + '\'');
+});</pre>
+
+<p>Add this to <code>quick_test.js</code> now.</p>
+
+<p><span class="p">Making sure you are inside your project directory, try running the test:</span></p>
+
+<pre class="brush: bash"><span class="p">node quick_test.js</span></pre>
+
+<p><span class="p">You should see the button's text label reported inside the console.</span></p>
+
+<p><span class="p">let's do something a bit more useful. delete the previous code entry, then add this line at the bottom instead:</span></p>
+
+<pre class="brush: js">button.click();</pre>
+
+<p>Try running your test again; the button will be clicked, and the <code>alert()</code> popup should appear. At least we know the button is working!</p>
+
+<p>You can interact with the popup too. Add the following to the bottom of the code, and try testing it again:</p>
+
+<pre class="brush: js">var alert = driver.switchTo().alert();
+
+alert.getText().then(function(text) {
+ console.log('Alert text is \'' + text + '\'');
+});
+
+alert.accept();</pre>
+
+<p>Next, let's try entering some text into one of the form elements. Add the following code and try running your test again:</p>
+
+<pre class="brush: js"><span class="kd">var</span> input <span class="o">=</span> <span class="nx">driver</span><span class="p">.</span><span class="nx">findElement</span><span class="p">(</span><span class="nx">By</span><span class="p">.</span><span class="nx">id</span><span class="p">(</span><span class="s1">'input1'</span><span class="p">));
+input.</span>sendKeys('Filling in my form');</pre>
+
+<p>You can submit key presses that can't be represented by normal characters using properties of the <code>webdriver.Key</code> object. 例えば、above we used this construct to tab out of the form input before submitting it:</p>
+
+<pre class="brush: js">driver.sleep(1000).then(function() {
+ driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB);
+});
+</pre>
+
+<h3 id="Waiting_for_something_to_complete" name="Waiting_for_something_to_complete">何かが完了するのを待つ</h3>
+
+<p>There are times where you'll want to make WebDriver wait for something to complete before carrying on. 例えば、if you load a new page, you'll want to wait for the page's DOM to finish loading before you try to interact with any of its elements, otherwise the test will likely fail.</p>
+
+<p>In our <code>google_test.js</code> test 例えば、we included this block:</p>
+
+<pre class="brush: js">driver.sleep(2000).then(function() {
+ driver.getTitle().then(function(title) {
+ if(title === 'webdriver - Google Search') {
+ console.log('Test passed');
+ } else {
+ console.log('Test failed');
+ }
+ });
+});</pre>
+
+<p>The <code>sleep()</code> method accepts a value that specifies the time to wait in milliseconds — the method returns a promise that resolves at the end of that time, at which point the code inside the <code>then()</code> executes. In this case we get the title of the current page with the <code>getTitle()</code> method, then return a pass or fail message depending on what its value is.</p>
+
+<p>We could add a <code>sleep()</code> method to our <code>quick_test.js</code> test too — try wrapping your last line of code in a block like this:</p>
+
+<pre class="brush: js">driver.sleep(2000).then(function() {
+  input.sendKeys('Filling in my form');
+  input.getAttribute("value").then(function(value) {
+    if(value !== '') {
+      console.log('Form input editable');
+    }
+  });
+});</pre>
+
+<p>WebDriver will now wait for 2 seconds before filling in the form field. We then test whether its value got filled in (i.e. is not empty) by using <code>getAttribute()</code> to retrieve it's <code>value</code> attribute value, and print a message to the console if it is not empty.</p>
+
+<div class="note">
+<p><strong>注</strong>: There is also a method called <code><a href="http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebDriver.html#wait">wait()</a></code>, which repeatedly tests a condition for a certain length of time, and then carries on executing the code. This also makes use of the <a href="https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/until.html">util library</a>, which defines common conditions to use along with <code>wait()</code>.</p>
+</div>
+
+<h3 id="Shutting_down_drivers_after_use" name="Shutting_down_drivers_after_use">使用後のドライバのシャットダウン</h3>
+
+<p>After you've finished running a test, you should shut down any dirver instances you've opened, to make sure that you don't end up with loads of rogue browser instances open on your machine! This is done using the <code>quit()</code> method. Simply call this on your driver instance when you are finished with it. Add this line to the bottom of your <code>quick_test.js</code> test now:</p>
+
+<pre class="brush: js"><span class="nx">driver</span><span class="p">.</span><span class="nx">quit</span><span class="p">();</span></pre>
+
+<p><span class="p">When you run it, you should now see the test execute and the browser instance shut down again after the text is complete. This is useful for not cluttering up your computer with loads of browser instances, especially if you have so many that it is causing the computer to slow down.</span></p>
+
+<h2 id="Test_best_practices" name="Test_best_practices">テストのベストプラクティス</h2>
+
+<p>There has been a lot written about best practices for writing tests. You can find some good background information at <a href="http://www.seleniumhq.org/docs/06_test_design_considerations.jsp">Test Design Considerations</a>. In general, you should make sure that your tests are:</p>
+
+<ol>
+ <li>Using good locator strategies: When you are {{anch("Interacting with the document")}}, make sure that you use locators and page objects that are unlikely to change — if you have a testable element that you want to perform a test on, make sure that it has a stable ID, or position on the page that can be selected using a CSS selector, which isn't going to just change with the next site iteration. You want to make your tests as non-brittle as possible, i.e. they won't just break when something changes.</li>
+ <li>Write atomic tests: Each test should test one thing only, making it easy to keep track of what test file is testing which criterion. As an example, the <code>google_test.js</code> test we looked at above is pretty good, as it just tests a single thing — whether the title of a search results page is set correctly. We could work on giving it a better name so it is easier to work out what it does if we add more google tests. Perhaps <code>results_page_title_set_correctly.js</code> would be slightly better?</li>
+ <li>Write autonomous tests: Each test should work on it's own, and not depend on other tests to work.</li>
+</ol>
+
+<p>In addition, we should mention test results/reporting — we've been reporting results in our above examples using simple <code>console.log()</code> statements, but this is all done in JavaScript, so you can use whatever test running and resorting system you want, be it <a href="https://mochajs.org/">Mocha</a>/<a href="http://chaijs.com/">Chai</a>/some other kind of combination.</p>
+
+<ol>
+ <li>例えば、try making a local copy of our <code><a href="https://github.com/mdn/learning-area/blob/master/tools-testing/cross-browser-testing/selenium/mocha_test.js">mocha_test.js</a></code> example inside your project directory. Put it inside a subfolder called <code>test</code>. This example uses a long chain of promises to run all the steps required in our test — the promise-based methods WebDriver uses need to resolve for it to work properly.</li>
+ <li>Install the mocha test harness by running the following command inside your project directory:
+ <pre class="brush: bash">npm install --save-dev mocha</pre>
+ </li>
+ <li>you can now run the test (and any others you put inside your <code>test</code> directory) using the following command:
+ <pre class="brush: bash">mocha --no-timeouts</pre>
+ </li>
+ <li>You should include the <code>--no-timeouts</code> flag to make sure your tests don't end up failing because of Mocha's arbitrary timeout (which is 3 seconds).</li>
+</ol>
+
+<div class="note">
+<p><strong>注</strong>: <a href="https://github.com/saucelabs-sample-test-frameworks">saucelabs-sample-test-frameworks</a> contains several useful examples showing how to set up different combinations of test/assertion tools.</p>
+</div>
+
+<h2 id="Running_remote_tests" name="Running_remote_tests">リモートテストの実行</h2>
+
+<p>It turns out that running tests on remote servers isn't that much more difficult than running them locally. You just need to create your driver instance, but with a few more features specified, including the capabilities of the browser you want to test on, the address of the server, and the user credentials you need (if any) to access it.</p>
+
+<h3 id="BrowserStack" name="BrowserStack">BrowserStack</h3>
+
+<p>Getting Selenium tests to run remotely on BrowserStack is easy. The code you need should follow the pattern seen below.</p>
+
+<p>Let's write an example:</p>
+
+<ol>
+ <li>Inside your project directory, create a new file called <code>bstack_google_test.js</code>.</li>
+ <li>Give it the following contents:
+ <pre class="brush: js">var webdriver = require('selenium-webdriver'),
+ By = webdriver.By,
+ until = webdriver.until;
+
+// Input capabilities
+var capabilities = {
+   'browserName' : 'Firefox',
+   'browser_version' : '56.0 beta',
+   'os' : 'OS X',
+   'os_version' : 'Sierra',
+   'resolution' : '1280x1024',
+   'browserstack.user' : '<code>YOUR-USER-NAME</code>',
+   'browserstack.key' : '<code>YOUR-ACCESS-KEY</code>',
+   'browserstack.debug' : 'true',
+   'build' : 'First build'
+};
+
+var driver = new webdriver.Builder().
+ usingServer('http://hub-cloud.browserstack.com/wd/hub').
+ withCapabilities(capabilities).
+ build();
+
+driver.get('http://www.google.com');
+driver.findElement(By.name('q')).sendKeys('webdriver');
+
+driver.sleep(1000).then(function() {
+ driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB);
+});
+
+driver.findElement(By.name('btnK')).click();
+
+driver.sleep(2000).then(function() {
+ driver.getTitle().then(function(title) {
+ if(title === 'webdriver - Google Search') {
+ console.log('Test passed');
+ } else {
+ console.log('Test failed');
+ }
+ });
+});
+
+driver.quit();</pre>
+ </li>
+ <li>From your <a href="https://www.browserstack.com/automate">BrowserStack automation dashboard</a>, get your user name and access key (see <em>Username and Access Keys</em>). Replace the <code>YOUR-USER-NAME</code> and <code>YOUR-ACCESS-KEY</code> placeholders in the code with your actual user name and access key values (and make sure you keep them secure).</li>
+ <li>Run your test with the following command:
+ <pre class="brush: bash">node bstack_google_test</pre>
+ The test will be sent to BrowserStack, and the test result will be returned to your console. This shows the importance of including some kind of result reporting mechanism!</li>
+ <li>Now if you go back to the <a href="https://www.browserstack.com/automate">BrowserStack automation dashboard</a> page, you'll see your test listed:<br>
+ <img alt="" src="https://mdn.mozillademos.org/files/15383/bstack_automated_results.png" style="border-style: solid; border-width: 1px; display: block; height: 189px; margin: 0px auto; width: 700px;"></li>
+</ol>
+
+<p>If you click on the link for your test, you'll get to a new screen where you will be able to see a video recording of the test, and multiple detailed logs of information pertaining to it.</p>
+
+<div class="note">
+<p><strong>注</strong>: The <em>Resources</em> menu option on the Browserstack automation dashboard contains a wealth of useful information on using it to run automated tests. See <a href="https://www.browserstack.com/automate/node">Node JS Documentation for writing automate test scripts in Node JS</a> for the node-specific information. Expore the docs to find out all the useful things BrowserStack can do.</p>
+</div>
+
+<div class="note">
+<p><strong>注</strong>: If you don't want to write out the capabilities objects for your tests by hand, you can generate them using the generators embedded in the docs. See <a href="https://www.browserstack.com/automate/node#run-tests-on-mobile">Run tests on mobile browsers</a> and <a href="https://www.browserstack.com/automate/node#setting-os-and-browser">Run tests on desktop browsers</a>.</p>
+</div>
+
+<h4 id="Filling_in_BrowserStack_test_details_programmatically" name="Filling_in_BrowserStack_test_details_programmatically">プログラムによるBrowserStackテストの詳細の入力</h4>
+
+<p>You can use the BrowserStack REST API and some other capabilities to annotate your test with more details, such as whether it passed, why it passed, what project the test is part of, etc. BrowserStack doesn't know these details 既定では!</p>
+
+<p>Let's update our <code>bstack_google_test.js</code> demo, to show how these features work:</p>
+
+<ol>
+ <li>First, we 'll need to import the node request module, so we can use it to send requests to the REST API. Add the following line at the very top of your code:
+ <pre class="brush: js">var request = require("request");</pre>
+ </li>
+ <li>Now we'll update our <code>capabilities</code> object to include a project name — add the following line before the closing curly brace, remembering to add a comma at the end of the previous line (you can vary the build and project names to organize the tests in different windows in the BrowserStack automation dashboard):
+ <pre class="brush: js">'project' : 'Google test 2'</pre>
+ </li>
+ <li>Next we need to access the <code>sessionId</code> of the current session, so we know where to send the request (the ID is included in the request URL, as you'll see later). Include the following lines just below the block that creates the <code>driver</code> object (<code>var driver ...</code>) :
+ <pre class="brush: js">var sessionId;
+
+driver.session_.then(function(sessionData) {
+ sessionId = sessionData.id_;
+});</pre>
+ </li>
+ <li>Finally, update the <code>driver.sleep(2000)</code> ... block near the bottom of the code to add REST API calls (again, replace the <code>YOUR-USER-NAME</code> and <code>YOUR-ACCESS-KEY</code> placeholders in the code with your actual user name and access key values):
+ <pre class="brush: js">driver.sleep(2000).then(function() {
+  driver.getTitle().then(function(title) {
+    if(title === 'webdriver - Google Search') {
+      console.log('Test passed');
+      request({uri: "https://<code>YOUR-USER-NAME</code>:<code>YOUR-ACCESS-KEY</code>@www.browserstack.com/automate/sessions/" + sessionId + ".json", method:"PUT", form:{"status":"passed","reason":"Google results showed correct title"}});
+    } else {
+      console.log('Test failed');
+      request({uri: "https://<code>YOUR-USER-NAME</code>:<code>YOUR-ACCESS-KEY</code>@www.browserstack.com/automate/sessions/" + sessionId + ".json", method:"PUT", form:{"status":"failed","reason":"Google results showed wrong title"}});
+    }
+  });
+});</pre>
+ </li>
+</ol>
+
+<p>These are fairly intuitive — once the test completes, we send an API call to BrowserStack to update the test with a passed or failed status, and a reason for the result.</p>
+
+<p>If you now go back to your <a href="https://www.browserstack.com/automate">BrowserStack automation dashboard</a> page, you should see your test session available, as before, but with the updated data attached to it:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/15385/bstack_custom_results.png" style="border-style: solid; border-width: 1px; display: block; margin: 0px auto;"></p>
+
+<h3 id="Sauce_Labs" name="Sauce_Labs">Sauce Labs</h3>
+
+<p>Getting Selenium tests to run remotely on Sauce Labs is also very simple, and very similar to BrowserStack albeit with a few syntactic differences. The code you need should follow the pattern seen below.</p>
+
+<p>Let's write an example:</p>
+
+<ol>
+ <li>Inside your project directory, create a new file called <code>sauce_google_test.js</code>.</li>
+ <li>Give it the following contents:
+ <pre class="brush: js">var webdriver = require('selenium-webdriver'),
+ By = webdriver.By,
+ until = webdriver.until,
+ username = "YOUR-USER-NAME",
+ accessKey = "YOUR-ACCESS-KEY";
+
+var driver = new webdriver.Builder()
+ .withCapabilities({
+ 'browserName': 'chrome',
+ 'platform': 'Windows XP',
+ 'version': '43.0',
+ 'username': username,
+ 'accessKey': accessKey
+ })
+ .usingServer("https://" + username + ":" + accessKey +
+ "@ondemand.saucelabs.com:443/wd/hub")
+ .build();
+
+driver.get('http://www.google.com');
+
+driver.findElement(By.name('q')).sendKeys('webdriver');
+
+driver.sleep(1000).then(function() {
+  driver.findElement(By.name('q')).sendKeys(webdriver.Key.TAB);
+});
+
+driver.findElement(By.name('btnK')).click();
+
+driver.sleep(2000).then(function() {
+ driver.getTitle().then(function(title) {
+ if(title === 'webdriver - Google Search') {
+ console.log('Test passed');
+ } else {
+ console.log('Test failed');
+ }
+ });
+});
+
+driver.quit();</pre>
+ </li>
+ <li>From your <a href="https://saucelabs.com/beta/user-settings">Sauce Labs user settings</a>, get your user name and access key. Replace the <code>YOUR-USER-NAME</code> and <code>YOUR-ACCESS-KEY</code> placeholders in the code with your actual user name and access key values (and make sure you keep them secure).</li>
+ <li>Run your test with the following command:
+ <pre class="brush: bash">node sauce_google_test</pre>
+ The test will be sent to Sauce Labs, and the test result will be returned to your console. This shows the importance of including some kind of result reporting mechanism!</li>
+ <li>Now if you go to your <a href="https://saucelabs.com/beta/dashboard/tests">Sauce Labs Automated Test dashboard</a> page, you'll see your test listed; from here you'll be able to see videos, screenshots, and other such data.<br>
+ <img alt="" src="https://mdn.mozillademos.org/files/14235/sauce_labs_automated_test.png" style="border-style: solid; border-width: 1px; display: block; margin: 0px auto;"></li>
+</ol>
+
+<div class="note">
+<p><strong>注</strong>: Sauce Labs' <a href="https://wiki.saucelabs.com/display/DOCS/Platform+Configurator/#/">Platform Configurator</a> is a useful tool for generating capability objects to feed to your driver instances, based on what browser/OS you want to test on.</p>
+</div>
+
+<div class="note">
+<p><strong>注</strong>: for more useful details on testing with Sauce Labs and Selenium, check out <a href="https://wiki.saucelabs.com/display/DOCS/Getting+Started+with+Selenium+for+Automated+Website+Testing">Getting Started with Selenium for Automated Website Testing</a>, and <a href="https://wiki.saucelabs.com/display/DOCS/Instant+Selenium+Node.js+Tests">Instant Selenium Node.js Tests</a>.</p>
+</div>
+
+<h4 id="Filling_in_Sauce_Labs_test_details_programmatically" name="Filling_in_Sauce_Labs_test_details_programmatically">Sauce Labsテストの詳細をプログラムで書き込む</h4>
+
+<p>You can use the Sauce Labs API to annotate your test with more details, such as whether it passed, the name of the test, etc. Sauce Labs doesn't know these details 既定では!</p>
+
+<p>To do this, you need to:</p>
+
+<ol>
+ <li>Install the Node Sauce Labs wrapper using the following command (if you've not already done it for this project):
+ <pre class="brush: bash"><code class="language-html">npm install saucelabs --save-dev</code></pre>
+ </li>
+ <li>Require saucelabs — put this at the top of your <code>sauce_google_test.js</code> file, just below the previous variable declarations:
+ <pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">var</span> SauceLabs <span class="operator token">=</span> <span class="function token">require</span><span class="punctuation token">(</span><span class="string token">'saucelabs'</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+ </li>
+ <li>Create a new instance of SauceLabs, by adding the following just below that:
+ <pre class="brush: js">var saucelabs = new SauceLabs({
+ username : "YOUR-USER-NAME",
+ password : "YOUR-ACCESS-KEY"
+});</pre>
+ Again, replace the <code>YOUR-USER-NAME</code> and <code>YOUR-ACCESS-KEY</code> placeholders in the code with your actual user name and access key values (note that the saucelabs npm package rather confusingly uses <code>password</code>, not <code>accessKey</code>). Since you are using these twice now, you may want to create a couple of helper variables to store them in.</li>
+ <li>Below the block where you define the <code>driver</code> variable (just below the <code>build()</code> line), add the following block — this gets the correct driver <code>sessionID</code> that we need to write data to the job (you can see it action in the next code block):
+ <pre class="brush: js">driver.getSession().then(function (sessionid){
+ driver.sessionID = sessionid.id_;
+});</pre>
+ </li>
+ <li>Finally, replace the <code>driver.sleep(2000)</code> ... block near the bottom of the code with the following:
+ <pre class="brush: js">driver.sleep(2000).then(function() {
+ driver.getTitle().then(function(title) {
+ if(title === 'webdriver - Google Search') {
+ console.log('Test passed');
+ var testPassed = true;
+ } else {
+ console.log('Test failed');
+ var testPassed = false;
+ }
+
+ saucelabs.updateJob(driver.sessionID, {
+ name: 'Google search results page title test',
+ passed: testPassed
+ });
+ });
+});</pre>
+ </li>
+</ol>
+
+<p>Here we've set a <code>testPassed</code> variable to <code>true</code> or <code>false</code> depending on whether the test passed or fails, then we've used the <code>saucelabs.updateJob()</code> method to update the details.</p>
+
+<p>If you now go back to your <a href="https://saucelabs.com/beta/dashboard/tests">Sauce Labs Automated Test dashboard</a> page, you should see your new job now has the updated data attached to it:</p>
+
+<p><img alt="" src="https://mdn.mozillademos.org/files/14239/sauce_labs_updated_job_info.png" style="border-style: solid; border-width: 1px; display: block; height: 150px; margin: 0px auto; width: 1088px;"></p>
+
+<h3 id="Your_own_remote_server" name="Your_own_remote_server">自身のリモートサーバ</h3>
+
+<p>If you don't want to use a service like Sauce Labs or BrowserStack, you can always set up your own remote testing server. Let's look at how to do this.</p>
+
+<ol>
+ <li>The Selenium remote server requires Java to run. Download the latest JDK for your platform from the <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Java SE downloads page</a>. Install it when it is downloaded.</li>
+ <li>Next, download the latest <a href="http://selenium-release.storage.googleapis.com/index.html">Selenium standalone server</a> — this acts as a proxy between your script and the browser drivers. Choose the latest stable version number (i.e. not a beta), and from the list choose a file starting with "selenium-server-standalone". When this has downloaded, put it in a sensible place, like in your home directory. If you've not already added the location to your <code>PATH</code>, do so now (see the {{anch("Setting up Selenium in Node")}} section).</li>
+ <li>Run the standalone server by entering the following into a terminal on your server computer
+ <pre class="brush: bash"><code>java -jar </code>selenium-server-standalone-3.0.0.jar</pre>
+ (update the <code>.jar</code> filename) so it matches exactly what file you've got.</li>
+ <li>The server will run on <code><a href="http://localhost:4444/wd/hub">http://localhost:4444/wd/hub</a></code> — try going there now to see what you get.</li>
+</ol>
+
+<p>Now we've got the server running, let's create a demo test that will run on the remote selenium server.</p>
+
+<ol>
+ <li>Create a copy of your <code>google_test.js</code> file, and call it <code>google_test_remote.js</code>; put it in your project directory.</li>
+ <li>Update the second code block (which starts with <code>var driver = </code>) like so
+ <pre class="brush: js">var driver = new webdriver.Builder()
+ .forBrowser('firefox')
+ .usingServer('http://localhost:4444/wd/hub')
+ .build();</pre>
+ </li>
+ <li>Run your test, and you should see it run as expected; this time however you will be runing it on the standalone server:
+ <pre class="brush: bash">node google_test_remote.js</pre>
+ </li>
+</ol>
+
+<p>So this is pretty cool. We have tested this locally, but you could set this up on just about any server along with the relevant browser drivers, and then connect your scripts to it using the URL you choose to expose it at.</p>
+
+<h2 id="Integrating_selenium_with_CI_tools" name="Integrating_selenium_with_CI_tools">selenium と CI ツールのインテグレーション</h2>
+
+<p>As another point, it is also possible to integrate Selenium and related tools like Sauce Labs with continuous integration (CI) tools — this is useful, as it means you can run your tests via a CI tool, and only commit new changes to your code repository if the tests pass.</p>
+
+<p>It is out of scope to look at this area in detail in this article, but we'd suggest getting started with Travis CI — this is probably the easiest CI tool to get started with, and has good integration with web tools like GitHub and Node.</p>
+
+<p>To get started, see 例えば、:</p>
+
+<ul>
+ <li><a href="https://docs.travis-ci.com/user/for-beginners">Travis CI for complete beginners</a></li>
+ <li><a href="https://docs.travis-ci.com/user/languages/javascript-with-nodejs/">Building a Node.js project</a> (with Travis)</li>
+ <li><a href="https://docs.travis-ci.com/user/sauce-connect/">Using Sauce Labs with Travis CI</a></li>
+</ul>
+
+<h2 id="Summary" name="Summary">まとめ</h2>
+
+<p>This module should have proven fun, and should have given you enough of an insight into writing and running automated tests for you to get going with writing your own automated tests.</p>
+
+<p>{{PreviousMenu("Learn/Tools_and_testing/Cross_browser_testing/Automated_testing", "Learn/Tools_and_testing/Cross_browser_testing")}}</p>
+
+
+
+<h2 id="In_this_module" name="In_this_module">このモジュール内</h2>
+
+<ul>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Introduction">Introduction to cross browser testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Testing_strategies">Strategies for carrying out testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/HTML_and_CSS">Handling common HTML and CSS problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/JavaScript">Handling common JavaScript problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility">Handling common accessibility problems</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection">Implementing feature detection</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Automated_testing">Introduction to automated testing</a></li>
+ <li><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing/Your_own_automation_environment">Setting up your own test automation environment</a></li>
+</ul>
+
+
+
+<div id="simple-translate-button" style="display: none;"></div>
+
+<div id="simple-translate-panel" style="display: none;">
+<p>...</p>
+</div>
+
+<div id="simple-translate-button"></div>
+
+<div id="simple-translate-panel">
+<p>...</p>
+</div>
diff --git a/files/ja/learn/tools_and_testing/index.html b/files/ja/learn/tools_and_testing/index.html
new file mode 100644
index 0000000000..152ebc54eb
--- /dev/null
+++ b/files/ja/learn/tools_and_testing/index.html
@@ -0,0 +1,49 @@
+---
+title: ツールとテスト
+slug: Learn/Tools_and_testing
+tags:
+ - CSS
+ - CodingScripting
+ - HTML
+ - JavaScript
+ - Landing
+ - TopicStub
+ - user testing
+ - アクセシビリティ
+ - クロスブラウザ
+ - ツール
+ - テスト
+ - トピック
+ - 初心者
+ - 学習
+ - 自動化
+translation_of: Learn/Tools_and_testing
+---
+<div>{{LearnSidebar}}</div>
+
+<p class="summary">ウェブ技術のコア (HTML, CSS,  JavaScript のような) での快適なプログラミングを開始して、経験を積んで、色んなリソースを読み、色んなコツや技を学習すると、JavaScript フレームワークからテスト自動化ツールやそれ以外まで、すべてのツールに出くわします。ウェブプロジェクトが大きく複雑になっていくと、こうしたツールを活用したり、コードの信頼できるテスト計画を考案したくなるでしょう。</p>
+
+<p>さらに、クロスブラウザーのサポートを引き続き維持することを念頭に置き、ユーザーのウェブブラウジングに使用されているさまざまなブラウザーやデバイス間でプロジェクトを動作させるベストプラクティスに従う必要があります。そして障害を持つ人々が利用できるようにすることです。</p>
+
+<p>あなたが使用すべきツールを考え出すことは難しい処理でありえるため、私たちは一連の記事を書いて、利用可能なツールの種類、あなたのためにできること、現在の業界のお気に入りを利用する方法をお伝えします。</p>
+
+<div class="note">
+<p><strong>メモ</strong>: このトピックでは多数のツールを参照していますが、必ずしもこれらのツールを最良または唯一の方法として推奨しているわけではなく、動作していてサポートしているためです。ほとんどの場合、他にも方法がありますが、古いものは時代遅れで、間違いなく新しいものが出てきます。</p>
+</div>
+
+<h2 id="Learning_pathway" name="Learning_pathway">学習経路</h2>
+
+<p>ここで説明したツールを使用する前にまずベースとなる <a href="/ja/docs/Learn/HTML">HTML</a>、<a href="/ja/docs/Learn/CSS">CSS</a>、および <a href="/ja/docs/Learn/JavaScript">JavaScript</a> 言語の基本を最初に理解しておく必要があります。たとえば、複雑な Web コードで問題をデバッグしたり、JavaScript フレームワークを効果的に使用したり、テストランナーなどを使用してコードをテストして実行したりする前に、これらの言語の基礎を知る必要があります。</p>
+
+<p>それに加えて、このトピックの最初のモジュールから始めて、そこでエリア全体の便利な概観を得るべきでしょう。</p>
+
+<h2 id="Modules" name="Modules">モジュール</h2>
+
+<dl>
+ <dt><a href="https://wiki.developer.mozilla.org/ja/docs/Learn/Tools_and_testing/Understanding_client-side_tools">クライアント側ウェブ開発ツールの理解</a></dt>
+ <dd>クライアント側のツールには脅威を感じますが、この記事シリーズではいくつかの普遍的なクライアント側のツール種類ごとに目的を例示して、一緒に連携させるツールや、パッケージマネージャーを使ったインストール方法、コマンドラインでの制御を説明します。最後にツールチェーンの例と、どのように生産的になるのかを示します。</dd>
+ <dt><a href="https://wiki.developer.mozilla.org/ja/docs/Learn/Tools_and_testing/GitHub">Git と GitHub</a></dt>
+ <dd>開発者はいくつかの <strong>バージョン管理システム</strong> (<strong>VCS</strong>)を使い、このツールにてプロジェクトの他の開発者と、お互いの成果を上書きする危険なく、後に問題が見つかった場合前バージョンのコードベースにロールバックできます。最も人気のある VCS (少なくともウェブ開発では) は <strong>Git</strong> と、それで動作するリポジトリとツールをホストするサイトの <strong>GitHub</strong> です。このモジュールではその両方について知っておくべきことを教えます。</dd>
+ <dt><a href="/ja/docs/Learn/Tools_and_testing/Cross_browser_testing">クロスブラウザーテスト</a></dt>
+ <dd>このモジュールではさまざまなブラウザー間でウェブプロジェクトをテストする領域を具体的に示しています。ここでは、ターゲットとするユーザー層 (たとえばユーザー、ブラウザー、デバイスの中で最も心配する必要があるもの)、テストの方法、さまざまな種類のコードで直面する主な問題、問題をテストして解決するのに最も有用なツールと、テストをスピードアップするために自動化する方法について説明します。</dd>
+</dl>