From ff9ea0cf9f0ea6217deefa7ad0dba35bf7f6c45e Mon Sep 17 00:00:00 2001 From: MDN Date: Thu, 8 Jul 2021 00:34:19 +0000 Subject: [CRON] sync translated content --- files/es/_redirects.txt | 5 +- files/es/_wikihistory.json | 16 +- .../web/api/htmlorforeignelement/focus/index.html | 165 +++++++++++++++++++++ .../web/api/htmlorforeignelement/focus/index.html | 165 --------------------- files/fr/_redirects.txt | 16 +- files/fr/_wikihistory.json | 48 +++--- .../web/api/htmlorforeignelement/blur/index.html | 89 +++++++++++ .../web/api/htmlorforeignelement/focus/index.html | 152 +++++++++++++++++++ .../web/api/htmlorforeignelement/blur/index.html | 89 ----------- .../web/api/htmlorforeignelement/focus/index.html | 152 ------------------- files/ja/_redirects.txt | 15 +- files/ja/_wikihistory.json | 50 +++---- .../web/api/htmlorforeignelement/blur/index.html | 89 +++++++++++ .../web/api/htmlorforeignelement/focus/index.html | 161 ++++++++++++++++++++ .../web/api/htmlorforeignelement/index.html | 59 ++++++++ .../web/api/htmlorforeignelement/blur/index.html | 88 ----------- .../web/api/htmlorforeignelement/focus/index.html | 160 -------------------- files/ja/web/api/htmlorforeignelement/index.html | 58 -------- files/pl/_redirects.txt | 32 ++-- files/pl/_wikihistory.json | 40 ++--- .../web/api/htmlorforeignelement/blur/index.html | 22 +++ .../web/api/htmlorforeignelement/focus/index.html | 24 +++ .../web/api/htmlorforeignelement/blur/index.html | 22 --- .../web/api/htmlorforeignelement/focus/index.html | 24 --- files/pt-br/_redirects.txt | 6 +- files/pt-br/_wikihistory.json | 26 ++-- .../web/api/htmlorforeignelement/blur/index.html | 88 +++++++++++ .../web/api/htmlorforeignelement/focus/index.html | 63 ++++++++ .../web/api/htmlorforeignelement/blur/index.html | 88 ----------- .../web/api/htmlorforeignelement/focus/index.html | 63 -------- files/zh-cn/_redirects.txt | 14 +- files/zh-cn/_wikihistory.json | 36 ++--- .../web/api/htmlorforeignelement/blur/index.html | 25 ++++ .../web/api/htmlorforeignelement/focus/index.html | 159 ++++++++++++++++++++ .../web/api/htmlorforeignelement/blur/index.html | 25 ---- .../web/api/htmlorforeignelement/focus/index.html | 159 -------------------- 36 files changed, 1252 insertions(+), 1241 deletions(-) create mode 100644 files/es/orphaned/web/api/htmlorforeignelement/focus/index.html delete mode 100644 files/es/web/api/htmlorforeignelement/focus/index.html create mode 100644 files/fr/orphaned/web/api/htmlorforeignelement/blur/index.html create mode 100644 files/fr/orphaned/web/api/htmlorforeignelement/focus/index.html delete mode 100644 files/fr/web/api/htmlorforeignelement/blur/index.html delete mode 100644 files/fr/web/api/htmlorforeignelement/focus/index.html create mode 100644 files/ja/orphaned/web/api/htmlorforeignelement/blur/index.html create mode 100644 files/ja/orphaned/web/api/htmlorforeignelement/focus/index.html create mode 100644 files/ja/orphaned/web/api/htmlorforeignelement/index.html delete mode 100644 files/ja/web/api/htmlorforeignelement/blur/index.html delete mode 100644 files/ja/web/api/htmlorforeignelement/focus/index.html delete mode 100644 files/ja/web/api/htmlorforeignelement/index.html create mode 100644 files/pl/orphaned/web/api/htmlorforeignelement/blur/index.html create mode 100644 files/pl/orphaned/web/api/htmlorforeignelement/focus/index.html delete mode 100644 files/pl/web/api/htmlorforeignelement/blur/index.html delete mode 100644 files/pl/web/api/htmlorforeignelement/focus/index.html create mode 100644 files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html create mode 100644 files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html delete mode 100644 files/pt-br/web/api/htmlorforeignelement/blur/index.html delete mode 100644 files/pt-br/web/api/htmlorforeignelement/focus/index.html create mode 100644 files/zh-cn/orphaned/web/api/htmlorforeignelement/blur/index.html create mode 100644 files/zh-cn/orphaned/web/api/htmlorforeignelement/focus/index.html delete mode 100644 files/zh-cn/web/api/htmlorforeignelement/blur/index.html delete mode 100644 files/zh-cn/web/api/htmlorforeignelement/focus/index.html (limited to 'files') diff --git a/files/es/_redirects.txt b/files/es/_redirects.txt index b33c7d6b85..1ae0cb1b94 100644 --- a/files/es/_redirects.txt +++ b/files/es/_redirects.txt @@ -1638,8 +1638,9 @@ /es/docs/Web/API/Geolocation.getCurrentPosition /es/docs/Web/API/Geolocation/getCurrentPosition /es/docs/Web/API/Geolocation.watchPosition /es/docs/Web/API/Geolocation/watchPosition /es/docs/Web/API/GlobalEventHandlers/onunload /es/docs/Web/API/WindowEventHandlers/onunload -/es/docs/Web/API/HTMLElement/focus /es/docs/Web/API/HTMLOrForeignElement/focus +/es/docs/Web/API/HTMLElement/focus /es/docs/orphaned/Web/API/HTMLOrForeignElement/focus /es/docs/Web/API/HTMLElement/invalid_event /es/docs/Web/API/HTMLInputElement/invalid_event +/es/docs/Web/API/HTMLOrForeignElement/focus /es/docs/orphaned/Web/API/HTMLOrForeignElement/focus /es/docs/Web/API/IDBObjectStore.add /es/docs/Web/API/IDBObjectStore/add /es/docs/Web/API/IndexedDB_API/Usando_IndexedDB /es/docs/Web/API/IndexedDB_API/Using_IndexedDB /es/docs/Web/API/Navigator.getUserMedia /es/docs/Web/API/Navigator/getUserMedia @@ -2773,5 +2774,3 @@ /es/docs/nsISupports:QueryInterface /es/docs/nsISupports/QueryInterface /es/docs/nsISupports:Release /es/docs/nsISupports/Release /es/docs/video /es/docs/Web/HTML/Element/video - - diff --git a/files/es/_wikihistory.json b/files/es/_wikihistory.json index dd18db74a0..d5ef8ed468 100644 --- a/files/es/_wikihistory.json +++ b/files/es/_wikihistory.json @@ -7507,14 +7507,6 @@ "baldore" ] }, - "Web/API/HTMLOrForeignElement/focus": { - "modified": "2020-10-15T21:51:27.517Z", - "contributors": [ - "IsraelFloresDGA", - "AlePerez92", - "jesumv" - ] - }, "Web/API/HTMLSelectElement": { "modified": "2020-10-15T22:06:34.378Z", "contributors": [ @@ -23282,6 +23274,14 @@ "AlePerez92" ] }, + "orphaned/Web/API/HTMLOrForeignElement/focus": { + "modified": "2020-10-15T21:51:27.517Z", + "contributors": [ + "IsraelFloresDGA", + "AlePerez92", + "jesumv" + ] + }, "orphaned/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB": { "modified": "2020-01-13T04:48:11.759Z", "contributors": [ diff --git a/files/es/orphaned/web/api/htmlorforeignelement/focus/index.html b/files/es/orphaned/web/api/htmlorforeignelement/focus/index.html new file mode 100644 index 0000000000..80a6e53783 --- /dev/null +++ b/files/es/orphaned/web/api/htmlorforeignelement/focus/index.html @@ -0,0 +1,165 @@ +--- +title: HTMLElement.focus() +slug: orphaned/Web/API/HTMLOrForeignElement/focus +tags: + - API + - HTML DOM + - HTMLElement + - Referencia + - metodo +translation_of: Web/API/HTMLOrForeignElement/focus +original_slug: Web/API/HTMLOrForeignElement/focus +--- +
{{ APIRef("HTML DOM") }}
+ +

El método HTMLElement.focus() fija el foco del cursor en el elemento indicado, si éste puede ser enfocado.

+ +

Sintaxis

+ +
element.focus();
+element.focus(focusOption); // Object parameter
+ +

Parámetros

+ +
+
focusOptions {{optional_inline}} {{experimental_inline}}
+
Es un objeto con la siguiente propiedad:
+
+
+
preventScroll {{optional_inline}}
+
Es un valor Boolean: +
    +
  • Si es false, el método hará scroll hasta que el elemento esté visible en la ventana del navegador
  • +
  • Si es true,  el método NO hará scroll hasta que el elemento esté visible en la ventana del navegador.
  • +
+
+
+
+
+ +

Ejemplos

+ +

Enfocar un campo de texto

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myTextField").focus();
+}
+ +

HTML

+ +
<input type="text" id="myTextField" value="Campo de texto.">
+<p></p>
+<button type="button" onclick="focusMethod()">¡Púlsame para enfocar el campo de texto!</button>
+
+ +

Resultado

+ +

{{ EmbedLiveSample('Focus_on_a_text_field') }}

+ +

Enfocar un botón

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myButton").focus();
+}
+
+ +

HTML

+ +
<button type="button" id="myButton">Púlsame!</button>
+<p></p>
+<button type="button" onclick="focusMethod()">¡Púlsame para enfocar el botón!</button>
+
+ +

Resultado

+ +

{{ EmbedLiveSample('Focus_on_a_button') }}

+ + + +

Enfocar con focusOption

+ +

JavaScript

+ +
focusScrollMethod = function getFocus() {
+  document.getElementById("myButton").focus({preventScroll:false});
+}
+focusNoScrollMethod = function getFocusWithoutScrolling() {
+  document.getElementById("myButton").focus({preventScroll:true});
+}
+
+
+ +

HTML

+ +
<button type="button" onclick="focusScrollMethod()">¡Púlsame para enfocar el botón!</button>
+<button type="button" onclick="focusNoScrollMethod()">¡Púlsame para enfocar el botón sin hacer scroll!</button>
+
+<div id="container" style="height: 1000px; width: 1000px;">
+<button type="button" id="myButton" style="margin-top: 500px;">¡Púlsame!</button>
+</div>
+
+
+ +

Resultado

+ +

{{ EmbedLiveSample('Focus_prevent_scroll') }}

+ +

Especificación

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaciónEstadoComentarios
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
+ +

Notas

+ +

Si se llama a HTMLElement.focus() desde un gestor de eventos "mousedown" (ratón presionado), se debe también llamar al método event.preventDefault() para evitar que el foco abandone HTMLElement.

+ +

Compatibilidad en navegadores

+ + + +

{{Compat("api.HTMLElement.focus")}}

+ +

Ver también

+ + diff --git a/files/es/web/api/htmlorforeignelement/focus/index.html b/files/es/web/api/htmlorforeignelement/focus/index.html deleted file mode 100644 index 9c7f8acf64..0000000000 --- a/files/es/web/api/htmlorforeignelement/focus/index.html +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: HTMLElement.focus() -slug: Web/API/HTMLOrForeignElement/focus -tags: - - API - - HTML DOM - - HTMLElement - - Referencia - - metodo -translation_of: Web/API/HTMLOrForeignElement/focus -original_slug: Web/API/HTMLElement/focus ---- -
{{ APIRef("HTML DOM") }}
- -

El método HTMLElement.focus() fija el foco del cursor en el elemento indicado, si éste puede ser enfocado.

- -

Sintaxis

- -
element.focus();
-element.focus(focusOption); // Object parameter
- -

Parámetros

- -
-
focusOptions {{optional_inline}} {{experimental_inline}}
-
Es un objeto con la siguiente propiedad:
-
-
-
preventScroll {{optional_inline}}
-
Es un valor Boolean: -
    -
  • Si es false, el método hará scroll hasta que el elemento esté visible en la ventana del navegador
  • -
  • Si es true,  el método NO hará scroll hasta que el elemento esté visible en la ventana del navegador.
  • -
-
-
-
-
- -

Ejemplos

- -

Enfocar un campo de texto

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myTextField").focus();
-}
- -

HTML

- -
<input type="text" id="myTextField" value="Campo de texto.">
-<p></p>
-<button type="button" onclick="focusMethod()">¡Púlsame para enfocar el campo de texto!</button>
-
- -

Resultado

- -

{{ EmbedLiveSample('Focus_on_a_text_field') }}

- -

Enfocar un botón

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myButton").focus();
-}
-
- -

HTML

- -
<button type="button" id="myButton">Púlsame!</button>
-<p></p>
-<button type="button" onclick="focusMethod()">¡Púlsame para enfocar el botón!</button>
-
- -

Resultado

- -

{{ EmbedLiveSample('Focus_on_a_button') }}

- - - -

Enfocar con focusOption

- -

JavaScript

- -
focusScrollMethod = function getFocus() {
-  document.getElementById("myButton").focus({preventScroll:false});
-}
-focusNoScrollMethod = function getFocusWithoutScrolling() {
-  document.getElementById("myButton").focus({preventScroll:true});
-}
-
-
- -

HTML

- -
<button type="button" onclick="focusScrollMethod()">¡Púlsame para enfocar el botón!</button>
-<button type="button" onclick="focusNoScrollMethod()">¡Púlsame para enfocar el botón sin hacer scroll!</button>
-
-<div id="container" style="height: 1000px; width: 1000px;">
-<button type="button" id="myButton" style="margin-top: 500px;">¡Púlsame!</button>
-</div>
-
-
- -

Resultado

- -

{{ EmbedLiveSample('Focus_prevent_scroll') }}

- -

Especificación

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EspecificaciónEstadoComentarios
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
- -

Notas

- -

Si se llama a HTMLElement.focus() desde un gestor de eventos "mousedown" (ratón presionado), se debe también llamar al método event.preventDefault() para evitar que el foco abandone HTMLElement.

- -

Compatibilidad en navegadores

- - - -

{{Compat("api.HTMLElement.focus")}}

- -

Ver también

- - diff --git a/files/fr/_redirects.txt b/files/fr/_redirects.txt index 422cf1788e..c6d2e6ed56 100644 --- a/files/fr/_redirects.txt +++ b/files/fr/_redirects.txt @@ -941,7 +941,7 @@ /fr/docs/DOM/element.addEventListener /fr/docs/Web/API/EventTarget/addEventListener /fr/docs/DOM/element.appendChild /fr/docs/Web/API/Node/appendChild /fr/docs/DOM/element.attributes /fr/docs/Web/API/Element/attributes -/fr/docs/DOM/element.blur /fr/docs/Web/API/HTMLOrForeignElement/blur +/fr/docs/DOM/element.blur /fr/docs/orphaned/Web/API/HTMLOrForeignElement/blur /fr/docs/DOM/element.childNodes /fr/docs/Web/API/Node/childNodes /fr/docs/DOM/element.classList /fr/docs/Web/API/Element/classList /fr/docs/DOM/element.className /fr/docs/Web/API/Element/className @@ -953,7 +953,7 @@ /fr/docs/DOM/element.dir /fr/docs/Web/API/HTMLElement/dir /fr/docs/DOM/element.dispatchEvent /fr/docs/Web/API/EventTarget/dispatchEvent /fr/docs/DOM/element.firstChild /fr/docs/Web/API/Node/firstChild -/fr/docs/DOM/element.focus /fr/docs/Web/API/HTMLOrForeignElement/focus +/fr/docs/DOM/element.focus /fr/docs/orphaned/Web/API/HTMLOrForeignElement/focus /fr/docs/DOM/element.getAttribute /fr/docs/Web/API/Element/getAttribute /fr/docs/DOM/element.getAttributeNS /fr/docs/Web/API/Element/getAttributeNS /fr/docs/DOM/element.getAttributeNode /fr/docs/Web/API/Element/getAttributeNode @@ -1102,7 +1102,7 @@ /fr/docs/DOM:element.addEventListener /fr/docs/Web/API/EventTarget/addEventListener /fr/docs/DOM:element.appendChild /fr/docs/Web/API/Node/appendChild /fr/docs/DOM:element.attributes /fr/docs/Web/API/Element/attributes -/fr/docs/DOM:element.blur /fr/docs/Web/API/HTMLOrForeignElement/blur +/fr/docs/DOM:element.blur /fr/docs/orphaned/Web/API/HTMLOrForeignElement/blur /fr/docs/DOM:element.childNodes /fr/docs/Web/API/Node/childNodes /fr/docs/DOM:element.className /fr/docs/Web/API/Element/className /fr/docs/DOM:element.click /fr/docs/Web/API/HTMLElement/click @@ -1113,7 +1113,7 @@ /fr/docs/DOM:element.dir /fr/docs/Web/API/HTMLElement/dir /fr/docs/DOM:element.dispatchEvent /fr/docs/Web/API/EventTarget/dispatchEvent /fr/docs/DOM:element.firstChild /fr/docs/Web/API/Node/firstChild -/fr/docs/DOM:element.focus /fr/docs/Web/API/HTMLOrForeignElement/focus +/fr/docs/DOM:element.focus /fr/docs/orphaned/Web/API/HTMLOrForeignElement/focus /fr/docs/DOM:element.getAttribute /fr/docs/Web/API/Element/getAttribute /fr/docs/DOM:element.getAttributeNS /fr/docs/Web/API/Element/getAttributeNS /fr/docs/DOM:element.getAttributeNode /fr/docs/Web/API/Element/getAttributeNode @@ -3684,7 +3684,7 @@ /fr/docs/Web/API/Element.addEventListener /fr/docs/Web/API/EventTarget/addEventListener /fr/docs/Web/API/Element.appendChild /fr/docs/Web/API/Node/appendChild /fr/docs/Web/API/Element.attributes /fr/docs/Web/API/Element/attributes -/fr/docs/Web/API/Element.blur /fr/docs/Web/API/HTMLOrForeignElement/blur +/fr/docs/Web/API/Element.blur /fr/docs/orphaned/Web/API/HTMLOrForeignElement/blur /fr/docs/Web/API/Element.childNodes /fr/docs/Web/API/Node/childNodes /fr/docs/Web/API/Element.classList /fr/docs/Web/API/Element/classList /fr/docs/Web/API/Element.className /fr/docs/Web/API/Element/className @@ -3695,7 +3695,7 @@ /fr/docs/Web/API/Element.cloneNode /fr/docs/Web/API/Node/cloneNode /fr/docs/Web/API/Element.dir /fr/docs/Web/API/HTMLElement/dir /fr/docs/Web/API/Element.firstElementChild /fr/docs/orphaned/Web/API/ParentNode/firstElementChild -/fr/docs/Web/API/Element.focus /fr/docs/Web/API/HTMLOrForeignElement/focus +/fr/docs/Web/API/Element.focus /fr/docs/orphaned/Web/API/HTMLOrForeignElement/focus /fr/docs/Web/API/Element.getAttribute /fr/docs/Web/API/Element/getAttribute /fr/docs/Web/API/Element.getAttributeNS /fr/docs/Web/API/Element/getAttributeNS /fr/docs/Web/API/Element.getAttributeNode /fr/docs/Web/API/Element/getAttributeNode @@ -3787,11 +3787,13 @@ /fr/docs/Web/API/GlobalFetch /fr/docs/Web/API/WindowOrWorkerGlobalScope /fr/docs/Web/API/GlobalFetch/fetch /fr/docs/Web/API/WindowOrWorkerGlobalScope/fetch /fr/docs/Web/API/HTMLElement/dataset /fr/docs/orphaned/Web/API/HTMLOrForeignElement/dataset -/fr/docs/Web/API/HTMLElement/focus /fr/docs/Web/API/HTMLOrForeignElement/focus +/fr/docs/Web/API/HTMLElement/focus /fr/docs/orphaned/Web/API/HTMLOrForeignElement/focus /fr/docs/Web/API/HTMLElement/style /fr/docs/orphaned/Web/API/ElementCSSInlineStyle/style /fr/docs/Web/API/HTMLElement/tabIndex /fr/docs/orphaned/Web/API/HTMLOrForeignElement/tabIndex /fr/docs/Web/API/HTMLFormElement/submit_event_ /fr/docs/Web/API/HTMLFormElement/submit_event +/fr/docs/Web/API/HTMLOrForeignElement/blur /fr/docs/orphaned/Web/API/HTMLOrForeignElement/blur /fr/docs/Web/API/HTMLOrForeignElement/dataset /fr/docs/orphaned/Web/API/HTMLOrForeignElement/dataset +/fr/docs/Web/API/HTMLOrForeignElement/focus /fr/docs/orphaned/Web/API/HTMLOrForeignElement/focus /fr/docs/Web/API/HTMLOrForeignElement/tabIndex /fr/docs/orphaned/Web/API/HTMLOrForeignElement/tabIndex /fr/docs/Web/API/HTMLTableElement.caption /fr/docs/Web/API/HTMLTableElement/caption /fr/docs/Web/API/HTMLTableElement.insertRow /fr/docs/Web/API/HTMLTableElement/insertRow diff --git a/files/fr/_wikihistory.json b/files/fr/_wikihistory.json index d3e4e2756f..d8cddd890e 100644 --- a/files/fr/_wikihistory.json +++ b/files/fr/_wikihistory.json @@ -17276,30 +17276,6 @@ "Jmarin" ] }, - "Web/API/HTMLOrForeignElement/blur": { - "modified": "2020-10-15T21:17:21.812Z", - "contributors": [ - "abvll", - "a-mt", - "teoli", - "jsx", - "tregagnon", - "BenoitL" - ] - }, - "Web/API/HTMLOrForeignElement/focus": { - "modified": "2019-10-10T16:45:54.605Z", - "contributors": [ - "HRobineau", - "a-mt", - "vava", - "fscholz", - "teoli", - "jsx", - "tregagnon", - "BenoitL" - ] - }, "Web/API/HTMLQuoteElement": { "modified": "2019-03-23T23:30:25.216Z", "contributors": [ @@ -44651,6 +44627,17 @@ "loella16" ] }, + "orphaned/Web/API/HTMLOrForeignElement/blur": { + "modified": "2020-10-15T21:17:21.812Z", + "contributors": [ + "abvll", + "a-mt", + "teoli", + "jsx", + "tregagnon", + "BenoitL" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/dataset": { "modified": "2020-10-15T21:37:22.950Z", "contributors": [ @@ -44661,6 +44648,19 @@ "Laurent_Lyaudet" ] }, + "orphaned/Web/API/HTMLOrForeignElement/focus": { + "modified": "2019-10-10T16:45:54.605Z", + "contributors": [ + "HRobineau", + "a-mt", + "vava", + "fscholz", + "teoli", + "jsx", + "tregagnon", + "BenoitL" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/tabIndex": { "modified": "2019-03-24T00:13:15.014Z", "contributors": [ diff --git a/files/fr/orphaned/web/api/htmlorforeignelement/blur/index.html b/files/fr/orphaned/web/api/htmlorforeignelement/blur/index.html new file mode 100644 index 0000000000..e9265721f5 --- /dev/null +++ b/files/fr/orphaned/web/api/htmlorforeignelement/blur/index.html @@ -0,0 +1,89 @@ +--- +title: HTMLElement.blur() +slug: orphaned/Web/API/HTMLOrForeignElement/blur +tags: + - API + - DOM + - HTMLElement + - Method + - Reference +translation_of: Web/API/HTMLOrForeignElement/blur +original_slug: Web/API/HTMLOrForeignElement/blur +--- +
+
{{ APIRef("HTML DOM") }}
+
+ +

La méthode HTMLElement.blur() retire le focus de l'élément courant.

+ +

Syntax

+ +
elt.blur()
+ +

Exemples

+ +

Retirer le focus d'un champ texte

+ +

HTML

+ +
<input type="text" id="myText" value="Champ texte.">
+<p></p>
+<button type="button" onclick="focusMethod()">Cliquez-moi pour donner le focus</button>
+<button type="button" onclick="blurMethod()">Cliquez-moi pour retirer le focus</button>
+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myText").focus();
+}
+blurMethod = function getBlur() {
+  document.getElementById("myText").blur();
+}
+ +

Résultat

+ +

{{ EmbedLiveSample('Remove_focus_from_a_text_area') }}

+ +

Spécification

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}{{Spec2('DOM2 HTML')}}
+ +

Compatibilité navigateur

+ + +

{{Compat("api.HTMLElement.blur")}}

+

Dans IE9-10, il y a un bug où appeler blur() sur le {{HTMLElement("body")}} change la fenêtre active du navigateur vers une autre application.

+ +

Voir aussi

+ +

La méthode DOM {{domxref("HTMLElement.focus()")}}

diff --git a/files/fr/orphaned/web/api/htmlorforeignelement/focus/index.html b/files/fr/orphaned/web/api/htmlorforeignelement/focus/index.html new file mode 100644 index 0000000000..c51d2ee0fa --- /dev/null +++ b/files/fr/orphaned/web/api/htmlorforeignelement/focus/index.html @@ -0,0 +1,152 @@ +--- +title: HTMLElement.focus() +slug: orphaned/Web/API/HTMLOrForeignElement/focus +tags: + - API + - HTML DOM + - HTMLElement +translation_of: Web/API/HTMLOrForeignElement/focus +original_slug: Web/API/HTMLOrForeignElement/focus +--- +
{{ APIRef("HTML DOM") }}
+ +

La méthode HTMLElement.focus() donne le focus à l'élément spécifié, s'il peut prendre le focus.

+ +

Syntaxe

+ +
element.focus();
+element.focus(focusOption); // Paramètre objet
+ +

Paramètres

+ +
+
focusOptions {{optional_inline}} {{experimental_inline}}
+
Est un objet ayant les propriétés suivantes:
+
+
+
preventScroll {{optional_inline}}
+
Est une valeur Boolean: +
    +
  • Si false, la méthode fera défiler la page pour que l'élément soit visible à l'écran.
  • +
  • Si true,  la méthode ne fera PAS défiler la page pour que l'élément soit visible à l'écran.
  • +
+
+
+
+
+ +

Exemples

+ +

Donner le focus à un champ texte

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myTextField").focus();
+}
+ +

HTML

+ +
<input type="text" id="myTextField" value="Champ texte.">
+<p></p>
+<button type="button" onclick="focusMethod()">Cliquez-moi pour donner le focus au champ texte!</button>
+ +

Résultat

+ +

{{ EmbedLiveSample('Focus_on_a_text_field') }}

+ +

Donner le focus à un bouton

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myButton").focus();
+}
+ +

HTML

+ +
<button type="button" id="myButton">Cliquez!</button>
+<p></p>
+<button type="button" onclick="focusMethod()">Cliquez-moi pour donner le focus au bouton!</button>
+ +

Résultat

+ +

{{ EmbedLiveSample('Focus_on_a_button') }}

+ +

Focus avec option

+ +

JavaScript

+ +
focusScrollMethod = function getFocus() {
+  document.getElementById("myButton").focus({preventScroll:false});
+}
+focusNoScrollMethod = function getFocusWithoutScrolling() {
+  document.getElementById("myButton").focus({preventScroll:true});
+}
+ +

HTML

+ +
<button type="button" onclick="focusScrollMethod()">Cliquez-moi pour donner le focus au bouton!</button>
+<button type="button" onclick="focusNoScrollMethod()">Cliquez-moi pour donner le focus au bouton sans défilement!</button>
+
+<div id="container" style="height: 1000px; width: 1000px;">
+<button type="button" id="myButton" style="margin-top: 500px;">Cliquez!</button>
+</div>
+ +

Résultat

+ +

{{ EmbedLiveSample('Focus_prevent_scroll') }}

+ +

Spécification

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
+ +

Notes

+ +

Si vous appelez HTMLElement.focus() à partir d'un gestionnaire d'événement mousedown, vous devez appeler event.preventDefault() pour empêcher le focus de quitter l'HTMLElement.

+ +

Compatibilité des navigateurs

+ +

{{Compat("api.HTMLElement.focus")}}

+ +

Voir aussi

+ + diff --git a/files/fr/web/api/htmlorforeignelement/blur/index.html b/files/fr/web/api/htmlorforeignelement/blur/index.html deleted file mode 100644 index 9eb3fa7a64..0000000000 --- a/files/fr/web/api/htmlorforeignelement/blur/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: HTMLElement.blur() -slug: Web/API/HTMLOrForeignElement/blur -tags: - - API - - DOM - - HTMLElement - - Method - - Reference -translation_of: Web/API/HTMLOrForeignElement/blur -original_slug: Web/API/Element.blur ---- -
-
{{ APIRef("HTML DOM") }}
-
- -

La méthode HTMLElement.blur() retire le focus de l'élément courant.

- -

Syntax

- -
elt.blur()
- -

Exemples

- -

Retirer le focus d'un champ texte

- -

HTML

- -
<input type="text" id="myText" value="Champ texte.">
-<p></p>
-<button type="button" onclick="focusMethod()">Cliquez-moi pour donner le focus</button>
-<button type="button" onclick="blurMethod()">Cliquez-moi pour retirer le focus</button>
- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myText").focus();
-}
-blurMethod = function getBlur() {
-  document.getElementById("myText").blur();
-}
- -

Résultat

- -

{{ EmbedLiveSample('Remove_focus_from_a_text_area') }}

- -

Spécification

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}{{Spec2('DOM2 HTML')}}
- -

Compatibilité navigateur

- - -

{{Compat("api.HTMLElement.blur")}}

-

Dans IE9-10, il y a un bug où appeler blur() sur le {{HTMLElement("body")}} change la fenêtre active du navigateur vers une autre application.

- -

Voir aussi

- -

La méthode DOM {{domxref("HTMLElement.focus()")}}

diff --git a/files/fr/web/api/htmlorforeignelement/focus/index.html b/files/fr/web/api/htmlorforeignelement/focus/index.html deleted file mode 100644 index cdf177b278..0000000000 --- a/files/fr/web/api/htmlorforeignelement/focus/index.html +++ /dev/null @@ -1,152 +0,0 @@ ---- -title: HTMLElement.focus() -slug: Web/API/HTMLOrForeignElement/focus -tags: - - API - - HTML DOM - - HTMLElement -translation_of: Web/API/HTMLOrForeignElement/focus -original_slug: Web/API/HTMLElement/focus ---- -
{{ APIRef("HTML DOM") }}
- -

La méthode HTMLElement.focus() donne le focus à l'élément spécifié, s'il peut prendre le focus.

- -

Syntaxe

- -
element.focus();
-element.focus(focusOption); // Paramètre objet
- -

Paramètres

- -
-
focusOptions {{optional_inline}} {{experimental_inline}}
-
Est un objet ayant les propriétés suivantes:
-
-
-
preventScroll {{optional_inline}}
-
Est une valeur Boolean: -
    -
  • Si false, la méthode fera défiler la page pour que l'élément soit visible à l'écran.
  • -
  • Si true,  la méthode ne fera PAS défiler la page pour que l'élément soit visible à l'écran.
  • -
-
-
-
-
- -

Exemples

- -

Donner le focus à un champ texte

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myTextField").focus();
-}
- -

HTML

- -
<input type="text" id="myTextField" value="Champ texte.">
-<p></p>
-<button type="button" onclick="focusMethod()">Cliquez-moi pour donner le focus au champ texte!</button>
- -

Résultat

- -

{{ EmbedLiveSample('Focus_on_a_text_field') }}

- -

Donner le focus à un bouton

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myButton").focus();
-}
- -

HTML

- -
<button type="button" id="myButton">Cliquez!</button>
-<p></p>
-<button type="button" onclick="focusMethod()">Cliquez-moi pour donner le focus au bouton!</button>
- -

Résultat

- -

{{ EmbedLiveSample('Focus_on_a_button') }}

- -

Focus avec option

- -

JavaScript

- -
focusScrollMethod = function getFocus() {
-  document.getElementById("myButton").focus({preventScroll:false});
-}
-focusNoScrollMethod = function getFocusWithoutScrolling() {
-  document.getElementById("myButton").focus({preventScroll:true});
-}
- -

HTML

- -
<button type="button" onclick="focusScrollMethod()">Cliquez-moi pour donner le focus au bouton!</button>
-<button type="button" onclick="focusNoScrollMethod()">Cliquez-moi pour donner le focus au bouton sans défilement!</button>
-
-<div id="container" style="height: 1000px; width: 1000px;">
-<button type="button" id="myButton" style="margin-top: 500px;">Cliquez!</button>
-</div>
- -

Résultat

- -

{{ EmbedLiveSample('Focus_prevent_scroll') }}

- -

Spécification

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
- -

Notes

- -

Si vous appelez HTMLElement.focus() à partir d'un gestionnaire d'événement mousedown, vous devez appeler event.preventDefault() pour empêcher le focus de quitter l'HTMLElement.

- -

Compatibilité des navigateurs

- -

{{Compat("api.HTMLElement.focus")}}

- -

Voir aussi

- - diff --git a/files/ja/_redirects.txt b/files/ja/_redirects.txt index ed20668cc1..034441a7e9 100644 --- a/files/ja/_redirects.txt +++ b/files/ja/_redirects.txt @@ -1477,7 +1477,7 @@ /ja/docs/DOM/element.appendChild /ja/docs/Web/API/Node/appendChild /ja/docs/DOM/element.attributes /ja/docs/Web/API/Element/attributes /ja/docs/DOM/element.baseURIObject /ja/docs/Web/API/Node -/ja/docs/DOM/element.blur /ja/docs/Web/API/HTMLOrForeignElement/blur +/ja/docs/DOM/element.blur /ja/docs/orphaned/Web/API/HTMLOrForeignElement/blur /ja/docs/DOM/element.childNodes /ja/docs/Web/API/Node/childNodes /ja/docs/DOM/element.classList /ja/docs/Web/API/Element/classList /ja/docs/DOM/element.className /ja/docs/Web/API/Element/className @@ -1490,7 +1490,7 @@ /ja/docs/DOM/element.dir /ja/docs/Web/API/HTMLElement/dir /ja/docs/DOM/element.dispatchEvent /ja/docs/Web/API/EventTarget/dispatchEvent /ja/docs/DOM/element.firstChild /ja/docs/Web/API/Node/firstChild -/ja/docs/DOM/element.focus /ja/docs/Web/API/HTMLOrForeignElement/focus +/ja/docs/DOM/element.focus /ja/docs/orphaned/Web/API/HTMLOrForeignElement/focus /ja/docs/DOM/element.getAttribute /ja/docs/Web/API/Element/getAttribute /ja/docs/DOM/element.getAttributeNS /ja/docs/Web/API/Element/getAttributeNS /ja/docs/DOM/element.getAttributeNode /ja/docs/Web/API/Element/getAttributeNode @@ -3820,9 +3820,9 @@ /ja/docs/Web/API/Geolocation/Using_geolocation /ja/docs/Web/API/Geolocation_API /ja/docs/Web/API/GlobalFetch /en-US/docs/Web/API/WindowOrWorkerGlobalScope /ja/docs/Web/API/GlobalFetch/fetch /ja/docs/Web/API/WindowOrWorkerGlobalScope/fetch -/ja/docs/Web/API/HTMLElement/blur /ja/docs/Web/API/HTMLOrForeignElement/blur +/ja/docs/Web/API/HTMLElement/blur /ja/docs/orphaned/Web/API/HTMLOrForeignElement/blur /ja/docs/Web/API/HTMLElement/dataset /ja/docs/orphaned/Web/API/HTMLOrForeignElement/dataset -/ja/docs/Web/API/HTMLElement/focus /ja/docs/Web/API/HTMLOrForeignElement/focus +/ja/docs/Web/API/HTMLElement/focus /ja/docs/orphaned/Web/API/HTMLOrForeignElement/focus /ja/docs/Web/API/HTMLElement/forceSpellCheck /ja/docs/orphaned/Web/API/HTMLElement/forceSpellCheck /ja/docs/Web/API/HTMLElement/nonce /ja/docs/orphaned/Web/API/HTMLOrForeignElement/nonce /ja/docs/Web/API/HTMLElement/style /ja/docs/orphaned/Web/API/ElementCSSInlineStyle/style @@ -3853,7 +3853,10 @@ /ja/docs/Web/API/HTMLHyperlinkElementUtils/username /ja/docs/Web/API/HTMLAnchorElement/username /ja/docs/Web/API/HTMLIFrameElement.getVisible /ja/docs/Web/API/HTMLIFrameElement/getVisible /ja/docs/Web/API/HTMLIFrameElement.stop /ja/docs/Web/API/HTMLIFrameElement/stop +/ja/docs/Web/API/HTMLOrForeignElement /ja/docs/orphaned/Web/API/HTMLOrForeignElement +/ja/docs/Web/API/HTMLOrForeignElement/blur /ja/docs/orphaned/Web/API/HTMLOrForeignElement/blur /ja/docs/Web/API/HTMLOrForeignElement/dataset /ja/docs/orphaned/Web/API/HTMLOrForeignElement/dataset +/ja/docs/Web/API/HTMLOrForeignElement/focus /ja/docs/orphaned/Web/API/HTMLOrForeignElement/focus /ja/docs/Web/API/HTMLOrForeignElement/nonce /ja/docs/orphaned/Web/API/HTMLOrForeignElement/nonce /ja/docs/Web/API/HTMLOrForeignElement/tabIndex /ja/docs/orphaned/Web/API/HTMLOrForeignElement/tabIndex /ja/docs/Web/API/HTMLTableElement.align /ja/docs/Web/API/HTMLTableElement/align @@ -4108,11 +4111,11 @@ /ja/docs/Web/API/document.write /ja/docs/Web/API/Document/write /ja/docs/Web/API/document.writeln /ja/docs/Web/API/Document/writeln /ja/docs/Web/API/document.xmlVersion /ja/docs/Web/API/Document/xmlVersion -/ja/docs/Web/API/element.blur /ja/docs/Web/API/HTMLOrForeignElement/blur +/ja/docs/Web/API/element.blur /ja/docs/orphaned/Web/API/HTMLOrForeignElement/blur /ja/docs/Web/API/element.className /ja/docs/Web/API/Element/className /ja/docs/Web/API/element.clientTop /ja/docs/Web/API/Element/clientTop /ja/docs/Web/API/element.dir /ja/docs/Web/API/HTMLElement/dir -/ja/docs/Web/API/element.focus /ja/docs/Web/API/HTMLOrForeignElement/focus +/ja/docs/Web/API/element.focus /ja/docs/orphaned/Web/API/HTMLOrForeignElement/focus /ja/docs/Web/API/element.getAttribute /ja/docs/Web/API/Element/getAttribute /ja/docs/Web/API/element.getBoundingClientRect /ja/docs/Web/API/Element/getBoundingClientRect /ja/docs/Web/API/element.hasAttribute /ja/docs/Web/API/Element/hasAttribute diff --git a/files/ja/_wikihistory.json b/files/ja/_wikihistory.json index 8e442ad50d..e71911f061 100644 --- a/files/ja/_wikihistory.json +++ b/files/ja/_wikihistory.json @@ -17029,31 +17029,6 @@ "mfuji09" ] }, - "Web/API/HTMLOrForeignElement": { - "modified": "2020-10-15T22:28:17.699Z", - "contributors": [ - "mfuji09" - ] - }, - "Web/API/HTMLOrForeignElement/blur": { - "modified": "2020-10-15T21:21:43.979Z", - "contributors": [ - "mfuji09", - "Wind1808", - "fscholz", - "ethertank" - ] - }, - "Web/API/HTMLOrForeignElement/focus": { - "modified": "2020-10-15T21:21:41.786Z", - "contributors": [ - "mfuji09", - "Wind1808", - "fscholz", - "Hasilt", - "ethertank" - ] - }, "Web/API/HTMLOutputElement": { "modified": "2020-10-15T21:18:44.480Z", "contributors": [ @@ -51739,6 +51714,21 @@ "Wind1808" ] }, + "orphaned/Web/API/HTMLOrForeignElement": { + "modified": "2020-10-15T22:28:17.699Z", + "contributors": [ + "mfuji09" + ] + }, + "orphaned/Web/API/HTMLOrForeignElement/blur": { + "modified": "2020-10-15T21:21:43.979Z", + "contributors": [ + "mfuji09", + "Wind1808", + "fscholz", + "ethertank" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/dataset": { "modified": "2020-10-15T21:36:48.934Z", "contributors": [ @@ -51748,6 +51738,16 @@ "Kenju" ] }, + "orphaned/Web/API/HTMLOrForeignElement/focus": { + "modified": "2020-10-15T21:21:41.786Z", + "contributors": [ + "mfuji09", + "Wind1808", + "fscholz", + "Hasilt", + "ethertank" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/nonce": { "modified": "2020-10-15T22:22:13.107Z", "contributors": [ diff --git a/files/ja/orphaned/web/api/htmlorforeignelement/blur/index.html b/files/ja/orphaned/web/api/htmlorforeignelement/blur/index.html new file mode 100644 index 0000000000..4d27786f8d --- /dev/null +++ b/files/ja/orphaned/web/api/htmlorforeignelement/blur/index.html @@ -0,0 +1,89 @@ +--- +title: HTMLElement.blur() +slug: orphaned/Web/API/HTMLOrForeignElement/blur +tags: + - API + - HTML DOM + - HTMLElement + - Method + - Reference +translation_of: Web/API/HTMLOrForeignElement/blur +original_slug: Web/API/HTMLOrForeignElement/blur +--- +
{{ APIRef("HTML DOM") }}
+ +

HTMLElement.blur() メソッドは、現在の要素からキーボードフォーカスを取り除きます。

+ +

構文

+ +
element.blur();
+ +

+ +

テキスト入力からフォーカスを取り除く

+ +

HTML

+ +
<input type="text" id="myText" value="サンプルテキスト">
+<br><br>
+<button type="button" onclick="focusInput()">クリックするとフォーカスを得ます</button>
+<button type="button" onclick="blurInput()">クリックするとフォーカスを失います</button>
+ +

JavaScript

+ +
function focusInput() {
+  document.getElementById('myText').focus();
+}
+function blurInput() {
+  document.getElementById('myText').blur();
+}
+ +

結果

+ +

{{ EmbedLiveSample('Remove_focus_from_a_text_input') }}

+ +

仕様

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}{{Spec2('DOM2 HTML')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.HTMLElement.blur")}}

+ +

関連情報

+ + diff --git a/files/ja/orphaned/web/api/htmlorforeignelement/focus/index.html b/files/ja/orphaned/web/api/htmlorforeignelement/focus/index.html new file mode 100644 index 0000000000..b611f9aa1c --- /dev/null +++ b/files/ja/orphaned/web/api/htmlorforeignelement/focus/index.html @@ -0,0 +1,161 @@ +--- +title: HTMLElement.focus() +slug: orphaned/Web/API/HTMLOrForeignElement/focus +tags: + - API + - Focus + - HTML DOM + - HTMLElement + - Method + - Reference + - Scroll + - View + - activate +translation_of: Web/API/HTMLOrForeignElement/focus +original_slug: Web/API/HTMLOrForeignElement/focus +--- +
{{ APIRef("HTML DOM") }}
+ +

HTMLElement.focus() メソッドは、指定された要素にフォーカスを設定できる場合、フォーカスを設定します。 フォーカスされた要素は、デフォルトでキーボードや同様のイベントを受け取る要素です。

+ +

構文

+ +
element.focus(options); // Object parameter
+ +

パラメーター

+ +
+
options {{optional_inline}}
+
フォーカスプロセスの側面を制御するオプションを提供するオプションのオブジェクト。 このオブジェクトには、次のプロパティが含まれる場合があります。
+
+
+
preventScroll {{optional_inline}}
+
ブラウザーがドキュメントをスクロールして、新しくフォーカスされた要素を表示するかどうかを示す Boolean の値。 preventScroll の値が false(デフォルト)の場合、ブラウザーは要素をフォーカスした後、その要素をスクロールして表示します。 preventScrolltrue に設定されている場合、スクロールしません。
+
+
+
+ +

+ +

テキストフィールドにフォーカスする

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myTextField").focus();
+}
+ +

HTML

+ +
<input type="text" id="myTextField" value="テキストフィールド">
+<p></p>
+<button type="button" onclick="focusMethod()">クリックしてテキストフィールドにフォーカスしてください!</button>
+
+ +

結果

+ +

{{ EmbedLiveSample('Focus_on_a_text_field') }}

+ +

ボタンにフォーカスする

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myButton").focus();
+}
+
+ +

HTML

+ +
<button type="button" id="myButton">クリックしてください!</button>
+<p></p>
+<button type="button" onclick="focusMethod()">クリックしてボタンにフォーカスしてください!</button>
+
+ +

結果

+ +

{{ EmbedLiveSample('Focus_on_a_button') }}

+ +

focusOption でフォーカスする

+ +

JavaScript

+ +
focusScrollMethod = function getFocus() {
+  document.getElementById("myButton").focus({preventScroll:false});
+}
+focusNoScrollMethod = function getFocusWithoutScrolling() {
+  document.getElementById("myButton").focus({preventScroll:true});
+}
+
+
+ +

HTML

+ +
<button type="button" onclick="focusScrollMethod()">クリックしてボタンにフォーカスしてください!</button>
+<button type="button" onclick="focusNoScrollMethod()">クリックしてスクロールせずにボタンにフォーカスしてください!</button>
+
+<div id="container" style="height: 1000px; width: 1000px;">
+<button type="button" id="myButton" style="margin-top: 500px;">クリックしてください!</button>
+</div>
+
+
+ +

結果

+ +

{{ EmbedLiveSample('Focus_prevent_scroll') }}

+ +

仕様

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
+ +

ノート

+ +

mousedown イベントハンドラから HTMLElement.focus() を呼び出す場合は、event.preventDefault() を呼び出して、フォーカスがその HTMLElement から離れないようにする必要があります。

+ +

ブラウザーの互換性

+ + + +

{{Compat("api.HTMLElement.focus")}}

+ +

関連情報

+ + diff --git a/files/ja/orphaned/web/api/htmlorforeignelement/index.html b/files/ja/orphaned/web/api/htmlorforeignelement/index.html new file mode 100644 index 0000000000..8fc2702a71 --- /dev/null +++ b/files/ja/orphaned/web/api/htmlorforeignelement/index.html @@ -0,0 +1,59 @@ +--- +title: HTMLOrForeignElement +slug: orphaned/Web/API/HTMLOrForeignElement +tags: + - API + - HTML + - HTMLElement + - HTMLOrForeignElement + - Interface + - MathML + - MathMLElement + - Mixin + - Reference + - SVG + - SVGElement + - ミックスイン +translation_of: Web/API/HTMLOrForeignElement +original_slug: Web/API/HTMLOrForeignElement +--- +
{{APIRef("HTML DOM")}}{{Draft}}
+ +

HTMLOrForeignElement ミックスインは、 {{DOMxRef("HTMLElement")}}, {{DOMxRef("SVGElement")}}, {{DOMxRef("MathMLElement")}} の各インターフェイスで共通のいくつかの機能を説明します。これらのインターフェイスは、もちろん、以下の列挙したものに加えたものに加えてもっと機能があります。

+ +
+

メモ: HTMLOrForeignElement はミックスインであり、インターフェイスではありません。実際に HTMLOrForeignElement 型のオブジェクトを生成することはできません。

+
+ +
{{InterfaceOverview("HTML DOM")}}
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("HTML WHATWG", "dom.html#htmlorsvgelement", 'HTMLOrForeignElement')}}{{Spec2('HTML WHATWG')}}初回定義
+ +

ブラウザーの互換性

+ +

{{Compat("api.HTMLOrForeignElement")}}

+ +

関連情報

+ + diff --git a/files/ja/web/api/htmlorforeignelement/blur/index.html b/files/ja/web/api/htmlorforeignelement/blur/index.html deleted file mode 100644 index 8a9cea1f8c..0000000000 --- a/files/ja/web/api/htmlorforeignelement/blur/index.html +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: HTMLElement.blur() -slug: Web/API/HTMLOrForeignElement/blur -tags: - - API - - HTML DOM - - HTMLElement - - Method - - Reference -translation_of: Web/API/HTMLOrForeignElement/blur ---- -
{{ APIRef("HTML DOM") }}
- -

HTMLElement.blur() メソッドは、現在の要素からキーボードフォーカスを取り除きます。

- -

構文

- -
element.blur();
- -

- -

テキスト入力からフォーカスを取り除く

- -

HTML

- -
<input type="text" id="myText" value="サンプルテキスト">
-<br><br>
-<button type="button" onclick="focusInput()">クリックするとフォーカスを得ます</button>
-<button type="button" onclick="blurInput()">クリックするとフォーカスを失います</button>
- -

JavaScript

- -
function focusInput() {
-  document.getElementById('myText').focus();
-}
-function blurInput() {
-  document.getElementById('myText').blur();
-}
- -

結果

- -

{{ EmbedLiveSample('Remove_focus_from_a_text_input') }}

- -

仕様

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
仕様状態コメント
{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}{{Spec2('DOM2 HTML')}}
- -

ブラウザーの互換性

- - - -

{{Compat("api.HTMLElement.blur")}}

- -

関連情報

- - diff --git a/files/ja/web/api/htmlorforeignelement/focus/index.html b/files/ja/web/api/htmlorforeignelement/focus/index.html deleted file mode 100644 index 2680fd8658..0000000000 --- a/files/ja/web/api/htmlorforeignelement/focus/index.html +++ /dev/null @@ -1,160 +0,0 @@ ---- -title: HTMLElement.focus() -slug: Web/API/HTMLOrForeignElement/focus -tags: - - API - - Focus - - HTML DOM - - HTMLElement - - Method - - Reference - - Scroll - - View - - activate -translation_of: Web/API/HTMLOrForeignElement/focus ---- -
{{ APIRef("HTML DOM") }}
- -

HTMLElement.focus() メソッドは、指定された要素にフォーカスを設定できる場合、フォーカスを設定します。 フォーカスされた要素は、デフォルトでキーボードや同様のイベントを受け取る要素です。

- -

構文

- -
element.focus(options); // Object parameter
- -

パラメーター

- -
-
options {{optional_inline}}
-
フォーカスプロセスの側面を制御するオプションを提供するオプションのオブジェクト。 このオブジェクトには、次のプロパティが含まれる場合があります。
-
-
-
preventScroll {{optional_inline}}
-
ブラウザーがドキュメントをスクロールして、新しくフォーカスされた要素を表示するかどうかを示す Boolean の値。 preventScroll の値が false(デフォルト)の場合、ブラウザーは要素をフォーカスした後、その要素をスクロールして表示します。 preventScrolltrue に設定されている場合、スクロールしません。
-
-
-
- -

- -

テキストフィールドにフォーカスする

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myTextField").focus();
-}
- -

HTML

- -
<input type="text" id="myTextField" value="テキストフィールド">
-<p></p>
-<button type="button" onclick="focusMethod()">クリックしてテキストフィールドにフォーカスしてください!</button>
-
- -

結果

- -

{{ EmbedLiveSample('Focus_on_a_text_field') }}

- -

ボタンにフォーカスする

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myButton").focus();
-}
-
- -

HTML

- -
<button type="button" id="myButton">クリックしてください!</button>
-<p></p>
-<button type="button" onclick="focusMethod()">クリックしてボタンにフォーカスしてください!</button>
-
- -

結果

- -

{{ EmbedLiveSample('Focus_on_a_button') }}

- -

focusOption でフォーカスする

- -

JavaScript

- -
focusScrollMethod = function getFocus() {
-  document.getElementById("myButton").focus({preventScroll:false});
-}
-focusNoScrollMethod = function getFocusWithoutScrolling() {
-  document.getElementById("myButton").focus({preventScroll:true});
-}
-
-
- -

HTML

- -
<button type="button" onclick="focusScrollMethod()">クリックしてボタンにフォーカスしてください!</button>
-<button type="button" onclick="focusNoScrollMethod()">クリックしてスクロールせずにボタンにフォーカスしてください!</button>
-
-<div id="container" style="height: 1000px; width: 1000px;">
-<button type="button" id="myButton" style="margin-top: 500px;">クリックしてください!</button>
-</div>
-
-
- -

結果

- -

{{ EmbedLiveSample('Focus_prevent_scroll') }}

- -

仕様

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
仕様状態コメント
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
- -

ノート

- -

mousedown イベントハンドラから HTMLElement.focus() を呼び出す場合は、event.preventDefault() を呼び出して、フォーカスがその HTMLElement から離れないようにする必要があります。

- -

ブラウザーの互換性

- - - -

{{Compat("api.HTMLElement.focus")}}

- -

関連情報

- - diff --git a/files/ja/web/api/htmlorforeignelement/index.html b/files/ja/web/api/htmlorforeignelement/index.html deleted file mode 100644 index 41dc389ca7..0000000000 --- a/files/ja/web/api/htmlorforeignelement/index.html +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: HTMLOrForeignElement -slug: Web/API/HTMLOrForeignElement -tags: - - API - - HTML - - HTMLElement - - HTMLOrForeignElement - - Interface - - MathML - - MathMLElement - - Mixin - - Reference - - SVG - - SVGElement - - ミックスイン -translation_of: Web/API/HTMLOrForeignElement ---- -
{{APIRef("HTML DOM")}}{{Draft}}
- -

HTMLOrForeignElement ミックスインは、 {{DOMxRef("HTMLElement")}}, {{DOMxRef("SVGElement")}}, {{DOMxRef("MathMLElement")}} の各インターフェイスで共通のいくつかの機能を説明します。これらのインターフェイスは、もちろん、以下の列挙したものに加えたものに加えてもっと機能があります。

- -
-

メモ: HTMLOrForeignElement はミックスインであり、インターフェイスではありません。実際に HTMLOrForeignElement 型のオブジェクトを生成することはできません。

-
- -
{{InterfaceOverview("HTML DOM")}}
- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName("HTML WHATWG", "dom.html#htmlorsvgelement", 'HTMLOrForeignElement')}}{{Spec2('HTML WHATWG')}}初回定義
- -

ブラウザーの互換性

- -

{{Compat("api.HTMLOrForeignElement")}}

- -

関連情報

- - diff --git a/files/pl/_redirects.txt b/files/pl/_redirects.txt index 4b8842a02d..2075c5e0ee 100644 --- a/files/pl/_redirects.txt +++ b/files/pl/_redirects.txt @@ -361,7 +361,7 @@ /pl/docs/DOM/element.addEventListener /pl/docs/Web/API/EventTarget/addEventListener /pl/docs/DOM/element.appendChild /pl/docs/Web/API/Node/appendChild /pl/docs/DOM/element.attributes /pl/docs/Web/API/Element/attributes -/pl/docs/DOM/element.blur /pl/docs/Web/API/HTMLOrForeignElement/blur +/pl/docs/DOM/element.blur /pl/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pl/docs/DOM/element.childNodes /pl/docs/Web/API/Node/childNodes /pl/docs/DOM/element.className /pl/docs/Web/API/Element/className /pl/docs/DOM/element.click /pl/docs/Web/API/HTMLElement/click @@ -372,7 +372,7 @@ /pl/docs/DOM/element.dir /pl/docs/Web/API/HTMLElement/dir /pl/docs/DOM/element.dispatchEvent /pl/docs/Web/API/EventTarget/dispatchEvent /pl/docs/DOM/element.firstChild /pl/docs/Web/API/Node/firstChild -/pl/docs/DOM/element.focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/DOM/element.focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/DOM/element.getAttribute /pl/docs/Web/API/Element/getAttribute /pl/docs/DOM/element.getAttributeNS /pl/docs/Web/API/Element/getAttributeNS /pl/docs/DOM/element.getAttributeNode /pl/docs/Web/API/Element/getAttributeNode @@ -600,7 +600,7 @@ /pl/docs/DOM:element.addEventListener /pl/docs/Web/API/EventTarget/addEventListener /pl/docs/DOM:element.appendChild /pl/docs/Web/API/Node/appendChild /pl/docs/DOM:element.attributes /pl/docs/Web/API/Element/attributes -/pl/docs/DOM:element.blur /pl/docs/Web/API/HTMLOrForeignElement/blur +/pl/docs/DOM:element.blur /pl/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pl/docs/DOM:element.childNodes /pl/docs/Web/API/Node/childNodes /pl/docs/DOM:element.className /pl/docs/Web/API/Element/className /pl/docs/DOM:element.click /pl/docs/Web/API/HTMLElement/click @@ -611,7 +611,7 @@ /pl/docs/DOM:element.dir /pl/docs/Web/API/HTMLElement/dir /pl/docs/DOM:element.dispatchEvent /pl/docs/Web/API/EventTarget/dispatchEvent /pl/docs/DOM:element.firstChild /pl/docs/Web/API/Node/firstChild -/pl/docs/DOM:element.focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/DOM:element.focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/DOM:element.getAttribute /pl/docs/Web/API/Element/getAttribute /pl/docs/DOM:element.getAttributeNS /pl/docs/Web/API/Element/getAttributeNS /pl/docs/DOM:element.getAttributeNode /pl/docs/Web/API/Element/getAttributeNode @@ -774,11 +774,11 @@ /pl/docs/Dokumentacja_Gecko_DOM/Wprowadzenie_do_DOM /pl/docs/Web/API/Document_Object_Model/Introduction /pl/docs/Dokumentacja_Gecko_DOM/document /pl/docs/Web/API/Document /pl/docs/Dokumentacja_Gecko_DOM/element /pl/docs/Web/API/Element -/pl/docs/Dokumentacja_Gecko_DOM/element.focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/Dokumentacja_Gecko_DOM/element.focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/Dokumentacja_Gecko_DOM/element/appendChild /pl/docs/Web/API/Node/appendChild -/pl/docs/Dokumentacja_Gecko_DOM/element/blur /pl/docs/Web/API/HTMLOrForeignElement/blur +/pl/docs/Dokumentacja_Gecko_DOM/element/blur /pl/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pl/docs/Dokumentacja_Gecko_DOM/element/cloneNode /pl/docs/Web/API/Node/cloneNode -/pl/docs/Dokumentacja_Gecko_DOM/element/focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/Dokumentacja_Gecko_DOM/element/focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/Dokumentacja_Gecko_DOM/element/getAttribute /pl/docs/Web/API/Element/getAttribute /pl/docs/Dokumentacja_Gecko_DOM/element/setAttribute /pl/docs/Web/API/Element/setAttribute /pl/docs/Dokumentacja_Gecko_DOM/window /pl/docs/Web/API/Window @@ -787,11 +787,11 @@ /pl/docs/Dokumentacja_Gecko_DOM:Wprowadzenie_do_DOM /pl/docs/Web/API/Document_Object_Model/Introduction /pl/docs/Dokumentacja_Gecko_DOM:document /pl/docs/Web/API/Document /pl/docs/Dokumentacja_Gecko_DOM:element /pl/docs/Web/API/Element -/pl/docs/Dokumentacja_Gecko_DOM:element.focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/Dokumentacja_Gecko_DOM:element.focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/Dokumentacja_Gecko_DOM:element:appendChild /pl/docs/Web/API/Node/appendChild -/pl/docs/Dokumentacja_Gecko_DOM:element:blur /pl/docs/Web/API/HTMLOrForeignElement/blur +/pl/docs/Dokumentacja_Gecko_DOM:element:blur /pl/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pl/docs/Dokumentacja_Gecko_DOM:element:cloneNode /pl/docs/Web/API/Node/cloneNode -/pl/docs/Dokumentacja_Gecko_DOM:element:focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/Dokumentacja_Gecko_DOM:element:focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/Dokumentacja_Gecko_DOM:element:getAttribute /pl/docs/Web/API/Element/getAttribute /pl/docs/Dokumentacja_Gecko_DOM:element:setAttribute /pl/docs/Web/API/Element/setAttribute /pl/docs/Dokumentacja_Gecko_DOM:window /pl/docs/Web/API/Window @@ -1564,14 +1564,14 @@ /pl/docs/Web/API/DocumentOrShadowRoot/styleSheets /pl/docs/Web/API/Document/styleSheets /pl/docs/Web/API/Element/addEventListener /pl/docs/Web/API/EventTarget/addEventListener /pl/docs/Web/API/Element/appendChild /pl/docs/Web/API/Node/appendChild -/pl/docs/Web/API/Element/blur /pl/docs/Web/API/HTMLOrForeignElement/blur +/pl/docs/Web/API/Element/blur /pl/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pl/docs/Web/API/Element/childNodes /pl/docs/Web/API/Node/childNodes /pl/docs/Web/API/Element/click /pl/docs/Web/API/HTMLElement/click /pl/docs/Web/API/Element/clientNode /pl/docs/Web/API/Node/cloneNode /pl/docs/Web/API/Element/dir /pl/docs/Web/API/HTMLElement/dir /pl/docs/Web/API/Element/dispatchEvent /pl/docs/Web/API/EventTarget/dispatchEvent /pl/docs/Web/API/Element/firstChild /pl/docs/Web/API/Node/firstChild -/pl/docs/Web/API/Element/focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/Web/API/Element/focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/Web/API/Element/hasChildNodes /pl/docs/Web/API/Node/hasChildNodes /pl/docs/Web/API/Element/insertBefore /pl/docs/Web/API/Node/insertBefore /pl/docs/Web/API/Element/lang /pl/docs/Web/API/HTMLElement/lang @@ -1617,6 +1617,8 @@ /pl/docs/Web/API/Event/screenY /pl/docs/Web/API/MouseEvent/screenY /pl/docs/Web/API/Event/shiftKey /pl/docs/Web/API/MouseEvent/shiftKey /pl/docs/Web/API/Event/view /pl/docs/Web/API/UIEvent/view +/pl/docs/Web/API/HTMLOrForeignElement/blur /pl/docs/orphaned/Web/API/HTMLOrForeignElement/blur +/pl/docs/Web/API/HTMLOrForeignElement/focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/Web/API/Navigator/appCodeName /pl/docs/Web/API/NavigatorID/appCodeName /pl/docs/Web/API/Navigator/appName /pl/docs/Web/API/NavigatorID/appName /pl/docs/Web/API/Navigator/appVersion /pl/docs/Web/API/NavigatorID/appVersion @@ -2579,13 +2581,11 @@ /pl/docs/Zdarzenia_online_i_offline /pl/docs/Web/API/NavigatorOnLine/Online_and_offline_events /pl/docs/Zmiany_XMLHttpRequest_dla_Gecko_1.8 /pl/docs/Zmiany_w_obiekcie_XMLHttpRequest_w_Gecko_1.8 /pl/docs/appendChild /pl/docs/Web/API/Node/appendChild -/pl/docs/blur /pl/docs/Web/API/HTMLOrForeignElement/blur +/pl/docs/blur /pl/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pl/docs/cloneNode /pl/docs/Web/API/Node/cloneNode /pl/docs/dziesiec_lat_mdn /pl/docs/MDN/At_ten /pl/docs/en /en-US/ -/pl/docs/focus /pl/docs/Web/API/HTMLOrForeignElement/focus +/pl/docs/focus /pl/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pl/docs/getAttribute /pl/docs/Web/API/Element/getAttribute /pl/docs/install.rdf /pl/docs/Manifesty_Instalacji /pl/docs/setAttribute /pl/docs/Web/API/Element/setAttribute - - diff --git a/files/pl/_wikihistory.json b/files/pl/_wikihistory.json index 0e0cda370c..b821a64d3f 100644 --- a/files/pl/_wikihistory.json +++ b/files/pl/_wikihistory.json @@ -2926,26 +2926,6 @@ "KubaKaszycki" ] }, - "Web/API/HTMLOrForeignElement/blur": { - "modified": "2019-03-23T23:47:16.796Z", - "contributors": [ - "teoli", - "jsx", - "Mgjbot", - "Ptak82", - "Jan Dudek" - ] - }, - "Web/API/HTMLOrForeignElement/focus": { - "modified": "2019-03-23T23:47:17.621Z", - "contributors": [ - "teoli", - "jsx", - "Mgjbot", - "Ptak82", - "Jan Dudek" - ] - }, "Web/API/HTMLSelectElement": { "modified": "2020-10-15T22:29:38.928Z", "contributors": [ @@ -11122,6 +11102,16 @@ "Jan Dudek" ] }, + "orphaned/Web/API/HTMLOrForeignElement/blur": { + "modified": "2019-03-23T23:47:16.796Z", + "contributors": [ + "teoli", + "jsx", + "Mgjbot", + "Ptak82", + "Jan Dudek" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/dataset": { "modified": "2020-10-15T22:07:00.382Z", "contributors": [ @@ -11129,6 +11119,16 @@ "lotny" ] }, + "orphaned/Web/API/HTMLOrForeignElement/focus": { + "modified": "2019-03-23T23:47:17.621Z", + "contributors": [ + "teoli", + "jsx", + "Mgjbot", + "Ptak82", + "Jan Dudek" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/tabIndex": { "modified": "2019-03-24T00:13:11.171Z", "contributors": [ diff --git a/files/pl/orphaned/web/api/htmlorforeignelement/blur/index.html b/files/pl/orphaned/web/api/htmlorforeignelement/blur/index.html new file mode 100644 index 0000000000..7ab774c03d --- /dev/null +++ b/files/pl/orphaned/web/api/htmlorforeignelement/blur/index.html @@ -0,0 +1,22 @@ +--- +title: element.blur +slug: orphaned/Web/API/HTMLOrForeignElement/blur +tags: + - DOM + - Dokumentacja_Gecko_DOM + - Gecko + - Wszystkie_kategorie +translation_of: Web/API/HTMLOrForeignElement/blur +original_slug: Web/API/HTMLOrForeignElement/blur +--- +

{{ ApiRef() }}

+

Podsumowanie

+

Metoda blur dezaktywuje bieżący element (usuwa focus).

+

Składnia

+
element.blur()
+
+

Specyfikacja

+

blur

+
+  
+

{{ languages( { "en": "en/DOM/element.blur", "fr": "fr/DOM/element.blur" } ) }}

diff --git a/files/pl/orphaned/web/api/htmlorforeignelement/focus/index.html b/files/pl/orphaned/web/api/htmlorforeignelement/focus/index.html new file mode 100644 index 0000000000..8a8f7e8a82 --- /dev/null +++ b/files/pl/orphaned/web/api/htmlorforeignelement/focus/index.html @@ -0,0 +1,24 @@ +--- +title: element.focus +slug: orphaned/Web/API/HTMLOrForeignElement/focus +tags: + - DOM + - Dokumentacja_Gecko_DOM + - Gecko + - Wszystkie_kategorie +translation_of: Web/API/HTMLOrForeignElement/focus +original_slug: Web/API/HTMLOrForeignElement/focus +--- +

{{ ApiRef() }}

+

Podsumowanie

+

focus aktywuje bieżący element (ustawia focus).

+

Składnia

+
element.focus()
+
+

Uwagi

+

Wywołanie metody focus() jest równoważne z zaznaczeniem elementu przez użytkownika.

+

Specyfikacja

+

focus

+
+  
+

{{ languages( { "en": "en/DOM/element.focus", "fr": "fr/DOM/element.focus" } ) }}

diff --git a/files/pl/web/api/htmlorforeignelement/blur/index.html b/files/pl/web/api/htmlorforeignelement/blur/index.html deleted file mode 100644 index 35d1e725eb..0000000000 --- a/files/pl/web/api/htmlorforeignelement/blur/index.html +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: element.blur -slug: Web/API/HTMLOrForeignElement/blur -tags: - - DOM - - Dokumentacja_Gecko_DOM - - Gecko - - Wszystkie_kategorie -translation_of: Web/API/HTMLOrForeignElement/blur -original_slug: Web/API/Element/blur ---- -

{{ ApiRef() }}

-

Podsumowanie

-

Metoda blur dezaktywuje bieżący element (usuwa focus).

-

Składnia

-
element.blur()
-
-

Specyfikacja

-

blur

-
-  
-

{{ languages( { "en": "en/DOM/element.blur", "fr": "fr/DOM/element.blur" } ) }}

diff --git a/files/pl/web/api/htmlorforeignelement/focus/index.html b/files/pl/web/api/htmlorforeignelement/focus/index.html deleted file mode 100644 index 4d5084b55a..0000000000 --- a/files/pl/web/api/htmlorforeignelement/focus/index.html +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: element.focus -slug: Web/API/HTMLOrForeignElement/focus -tags: - - DOM - - Dokumentacja_Gecko_DOM - - Gecko - - Wszystkie_kategorie -translation_of: Web/API/HTMLOrForeignElement/focus -original_slug: Web/API/Element/focus ---- -

{{ ApiRef() }}

-

Podsumowanie

-

focus aktywuje bieżący element (ustawia focus).

-

Składnia

-
element.focus()
-
-

Uwagi

-

Wywołanie metody focus() jest równoważne z zaznaczeniem elementu przez użytkownika.

-

Specyfikacja

-

focus

-
-  
-

{{ languages( { "en": "en/DOM/element.focus", "fr": "fr/DOM/element.focus" } ) }}

diff --git a/files/pt-br/_redirects.txt b/files/pt-br/_redirects.txt index c2949a76c0..4e110b2d75 100644 --- a/files/pt-br/_redirects.txt +++ b/files/pt-br/_redirects.txt @@ -578,10 +578,12 @@ /pt-BR/docs/Web/API/Event/Comparativo_entre_Event_Targets /pt-BR/docs/Web/API/Event/Comparison_of_Event_Targets /pt-BR/docs/Web/API/Fetch_API/Uso_de_busca_Cross-global /pt-BR/docs/Web/API/Fetch_API/Cross-global_fetch_usage /pt-BR/docs/Web/API/HTMLContentElement/Seletor /pt-BR/docs/Web/API/HTMLContentElement/select -/pt-BR/docs/Web/API/HTMLElement/blur /pt-BR/docs/Web/API/HTMLOrForeignElement/blur +/pt-BR/docs/Web/API/HTMLElement/blur /pt-BR/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pt-BR/docs/Web/API/HTMLElement/dataset /pt-BR/docs/orphaned/Web/API/HTMLOrForeignElement/dataset -/pt-BR/docs/Web/API/HTMLElement/focus /pt-BR/docs/Web/API/HTMLOrForeignElement/focus +/pt-BR/docs/Web/API/HTMLElement/focus /pt-BR/docs/orphaned/Web/API/HTMLOrForeignElement/focus +/pt-BR/docs/Web/API/HTMLOrForeignElement/blur /pt-BR/docs/orphaned/Web/API/HTMLOrForeignElement/blur /pt-BR/docs/Web/API/HTMLOrForeignElement/dataset /pt-BR/docs/orphaned/Web/API/HTMLOrForeignElement/dataset +/pt-BR/docs/Web/API/HTMLOrForeignElement/focus /pt-BR/docs/orphaned/Web/API/HTMLOrForeignElement/focus /pt-BR/docs/Web/API/History_API/Exemplo /pt-BR/docs/Web/API/History_API/Example /pt-BR/docs/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB /pt-BR/docs/orphaned/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB /pt-BR/docs/Web/API/IndexedDB_API/Usando_IndexedDB /pt-BR/docs/Web/API/IndexedDB_API/Using_IndexedDB diff --git a/files/pt-br/_wikihistory.json b/files/pt-br/_wikihistory.json index 922f776130..ff2f3fae11 100644 --- a/files/pt-br/_wikihistory.json +++ b/files/pt-br/_wikihistory.json @@ -5610,19 +5610,6 @@ "Rogerio-Viana" ] }, - "Web/API/HTMLOrForeignElement/blur": { - "modified": "2020-10-15T22:12:54.970Z", - "contributors": [ - "salgueiroso" - ] - }, - "Web/API/HTMLOrForeignElement/focus": { - "modified": "2019-03-23T22:24:13.859Z", - "contributors": [ - "erikseyti", - "brunopulis" - ] - }, "Web/API/HTMLSelectElement": { "modified": "2019-03-18T21:38:12.809Z", "contributors": [ @@ -17005,6 +16992,12 @@ "bermarques" ] }, + "orphaned/Web/API/HTMLOrForeignElement/blur": { + "modified": "2020-10-15T22:12:54.970Z", + "contributors": [ + "salgueiroso" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/dataset": { "modified": "2020-10-15T21:46:41.594Z", "contributors": [ @@ -17014,6 +17007,13 @@ "emanueloliveira" ] }, + "orphaned/Web/API/HTMLOrForeignElement/focus": { + "modified": "2019-03-23T22:24:13.859Z", + "contributors": [ + "erikseyti", + "brunopulis" + ] + }, "orphaned/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB": { "modified": "2020-01-13T04:48:43.968Z", "contributors": [ diff --git a/files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html b/files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html new file mode 100644 index 0000000000..2ce85ac57e --- /dev/null +++ b/files/pt-br/orphaned/web/api/htmlorforeignelement/blur/index.html @@ -0,0 +1,88 @@ +--- +title: HTMLElement.blur() +slug: orphaned/Web/API/HTMLOrForeignElement/blur +tags: + - API + - DOM HTML + - Foco + - HTMLElement + - Referencia + - metodo +translation_of: Web/API/HTMLOrForeignElement/blur +original_slug: Web/API/HTMLOrForeignElement/blur +--- +
{{ APIRef("HTML DOM") }}
+ +

O método HTMLElement.blur() remove o foco do teclado no elemento corrente.

+ +

Sintaxe

+ +
elemento.blur();
+ +

Exemplos

+ +

Removendo o foco de um input de texto

+ +

HTML

+ +
<input type="text" id="meuTexto" value="Texto Exemplo">
+<br><br>
+<button type="button" onclick="focusInput()">Clique para definir o foco</button>
+<button type="button" onclick="blurInput()">Clique para remover o foco</button>
+ +

JavaScript

+ +
function focusInput() {
+  document.getElementById('meuTexto').focus();
+}
+function blurInput() {
+  document.getElementById('meuTexto').blur();
+}
+ +

Resultado

+ +

{{ EmbedLiveSample('Remove_focus_from_a_text_input') }}

+ +

Especificação

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}{{Spec2('HTML5.1')}} 
{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}{{Spec2('DOM2 HTML')}} 
+ +

Compatibilidade com navegadores

+ +

{{Compat("api.HTMLElement.blur")}}

+ +

Veja também

+ + diff --git a/files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html b/files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html new file mode 100644 index 0000000000..d2da909bc6 --- /dev/null +++ b/files/pt-br/orphaned/web/api/htmlorforeignelement/focus/index.html @@ -0,0 +1,63 @@ +--- +title: HTMLElement.focus() +slug: orphaned/Web/API/HTMLOrForeignElement/focus +translation_of: Web/API/HTMLOrForeignElement/focus +original_slug: Web/API/HTMLOrForeignElement/focus +--- +
{{ APIRef("HTML DOM") }}
+ +

O método HTMLElement.focus()  seta o foco em um determinado elemento em especifico, caso esse elemento permita ter o foco neste elemento.

+ +

Síntaxe

+ +
element.focus()
+ +

Especificação

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}} 
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}} 
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}} 
+ +

Notas

+ +

Caso você utilize o HTMLElement.focus() por meio da manipulação de um evento mousedown , você deve utilizar o evento event.preventDefault() a fim de o foco não sair do arquivo HTMLElement.

+ +

Veja também

+ + diff --git a/files/pt-br/web/api/htmlorforeignelement/blur/index.html b/files/pt-br/web/api/htmlorforeignelement/blur/index.html deleted file mode 100644 index cf416441d4..0000000000 --- a/files/pt-br/web/api/htmlorforeignelement/blur/index.html +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: HTMLElement.blur() -slug: Web/API/HTMLOrForeignElement/blur -tags: - - API - - DOM HTML - - Foco - - HTMLElement - - Referencia - - metodo -translation_of: Web/API/HTMLOrForeignElement/blur -original_slug: Web/API/HTMLElement/blur ---- -
{{ APIRef("HTML DOM") }}
- -

O método HTMLElement.blur() remove o foco do teclado no elemento corrente.

- -

Sintaxe

- -
elemento.blur();
- -

Exemplos

- -

Removendo o foco de um input de texto

- -

HTML

- -
<input type="text" id="meuTexto" value="Texto Exemplo">
-<br><br>
-<button type="button" onclick="focusInput()">Clique para definir o foco</button>
-<button type="button" onclick="blurInput()">Clique para remover o foco</button>
- -

JavaScript

- -
function focusInput() {
-  document.getElementById('meuTexto').focus();
-}
-function blurInput() {
-  document.getElementById('meuTexto').blur();
-}
- -

Resultado

- -

{{ EmbedLiveSample('Remove_focus_from_a_text_input') }}

- -

Especificação

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', 'editing.html#blur()-0', 'blur')}}{{Spec2('HTML5.1')}} 
{{SpecName('HTML5 W3C', 'editing.html#dom-blur', 'blur')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('DOM2 HTML', 'html.html#ID-28216144', 'blur')}}{{Spec2('DOM2 HTML')}} 
- -

Compatibilidade com navegadores

- -

{{Compat("api.HTMLElement.blur")}}

- -

Veja também

- - diff --git a/files/pt-br/web/api/htmlorforeignelement/focus/index.html b/files/pt-br/web/api/htmlorforeignelement/focus/index.html deleted file mode 100644 index 4649b935b9..0000000000 --- a/files/pt-br/web/api/htmlorforeignelement/focus/index.html +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: HTMLElement.focus() -slug: Web/API/HTMLOrForeignElement/focus -translation_of: Web/API/HTMLOrForeignElement/focus -original_slug: Web/API/HTMLElement/focus ---- -
{{ APIRef("HTML DOM") }}
- -

O método HTMLElement.focus()  seta o foco em um determinado elemento em especifico, caso esse elemento permita ter o foco neste elemento.

- -

Síntaxe

- -
element.focus()
- -

Especificação

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EspecificaçãoStatusComentário
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}} 
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}} 
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}} 
- -

Notas

- -

Caso você utilize o HTMLElement.focus() por meio da manipulação de um evento mousedown , você deve utilizar o evento event.preventDefault() a fim de o foco não sair do arquivo HTMLElement.

- -

Veja também

- - diff --git a/files/zh-cn/_redirects.txt b/files/zh-cn/_redirects.txt index c778b9b554..7089de546a 100644 --- a/files/zh-cn/_redirects.txt +++ b/files/zh-cn/_redirects.txt @@ -422,7 +422,7 @@ /zh-CN/docs/DOM/element /zh-CN/docs/Web/API/element /zh-CN/docs/DOM/element.addEventListener /zh-CN/docs/Web/API/EventTarget/addEventListener /zh-CN/docs/DOM/element.attributes /zh-CN/docs/Web/API/Element/attributes -/zh-CN/docs/DOM/element.blur /zh-CN/docs/Web/API/HTMLOrForeignElement/blur +/zh-CN/docs/DOM/element.blur /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/blur /zh-CN/docs/DOM/element.childElementCount /zh-CN/docs/Web/API/Element/childElementCount /zh-CN/docs/DOM/element.childNodes /zh-CN/docs/Web/API/Node/childNodes /zh-CN/docs/DOM/element.classList /zh-CN/docs/Web/API/Element/classList @@ -435,7 +435,7 @@ /zh-CN/docs/DOM/element.cloneNode /zh-CN/docs/Web/API/Node/cloneNode /zh-CN/docs/DOM/element.contentEditable /zh-CN/docs/Web/API/HTMLElement/contentEditable /zh-CN/docs/DOM/element.dir /zh-CN/docs/Web/API/HTMLElement/dir -/zh-CN/docs/DOM/element.focus /zh-CN/docs/Web/API/HTMLOrForeignElement/focus +/zh-CN/docs/DOM/element.focus /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/focus /zh-CN/docs/DOM/element.getElementsByTagName /zh-CN/docs/Web/API/Element/getElementsByTagName /zh-CN/docs/DOM/element.hasAttributes /zh-CN/docs/Web/API/Element/hasAttributes /zh-CN/docs/DOM/element.hasChildNodes /zh-CN/docs/Web/API/Node/hasChildNodes @@ -1620,12 +1620,12 @@ /zh-CN/docs/Web/API/GlobalFetch/fetch /zh-CN/docs/Web/API/WindowOrWorkerGlobalScope/fetch /zh-CN/docs/Web/API/HTMLAnchorElement/referrer /zh-CN/docs/Web/API/HTMLAnchorElement/referrerPolicy /zh-CN/docs/Web/API/HTMLCanvasElement/捕获流 /zh-CN/docs/Web/API/HTMLCanvasElement/captureStream -/zh-CN/docs/Web/API/HTMLElement.blur /zh-CN/docs/Web/API/HTMLOrForeignElement/blur +/zh-CN/docs/Web/API/HTMLElement.blur /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/blur /zh-CN/docs/Web/API/HTMLElement.click /zh-CN/docs/Web/API/HTMLElement/click /zh-CN/docs/Web/API/HTMLElement.contentEditable /zh-CN/docs/Web/API/HTMLElement/contentEditable /zh-CN/docs/Web/API/HTMLElement.dataset /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/dataset /zh-CN/docs/Web/API/HTMLElement.dir /zh-CN/docs/Web/API/HTMLElement/dir -/zh-CN/docs/Web/API/HTMLElement.focus /zh-CN/docs/Web/API/HTMLOrForeignElement/focus +/zh-CN/docs/Web/API/HTMLElement.focus /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/focus /zh-CN/docs/Web/API/HTMLElement.isContentEditable /zh-CN/docs/Web/API/HTMLElement/isContentEditable /zh-CN/docs/Web/API/HTMLElement.lang /zh-CN/docs/Web/API/HTMLElement/lang /zh-CN/docs/Web/API/HTMLElement.offsetLeft /zh-CN/docs/Web/API/HTMLElement/offsetLeft @@ -1635,9 +1635,9 @@ /zh-CN/docs/Web/API/HTMLElement.style /zh-CN/docs/orphaned/Web/API/ElementCSSInlineStyle/style /zh-CN/docs/Web/API/HTMLElement.tabIndex /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/tabIndex /zh-CN/docs/Web/API/HTMLElement.title /zh-CN/docs/Web/API/HTMLElement/title -/zh-CN/docs/Web/API/HTMLElement/blur /zh-CN/docs/Web/API/HTMLOrForeignElement/blur +/zh-CN/docs/Web/API/HTMLElement/blur /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/blur /zh-CN/docs/Web/API/HTMLElement/dataset /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/dataset -/zh-CN/docs/Web/API/HTMLElement/focus /zh-CN/docs/Web/API/HTMLOrForeignElement/focus +/zh-CN/docs/Web/API/HTMLElement/focus /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/focus /zh-CN/docs/Web/API/HTMLElement/forceSpellCheck /zh-CN/docs/orphaned/Web/API/HTMLElement/forceSpellCheck /zh-CN/docs/Web/API/HTMLElement/nonce /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/nonce /zh-CN/docs/Web/API/HTMLElement/style /zh-CN/docs/orphaned/Web/API/ElementCSSInlineStyle/style @@ -1656,7 +1656,9 @@ /zh-CN/docs/Web/API/HTMLHyperlinkElementUtils/username /zh-CN/docs/Web/API/HTMLAnchorElement/username /zh-CN/docs/Web/API/HTMLInputElement.mozSetFileNameArray /zh-CN/docs/conflicting/Web/API/HTMLInputElement /zh-CN/docs/Web/API/HTMLInputElement/mozSetFileNameArray /zh-CN/docs/conflicting/Web/API/HTMLInputElement +/zh-CN/docs/Web/API/HTMLOrForeignElement/blur /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/blur /zh-CN/docs/Web/API/HTMLOrForeignElement/dataset /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/dataset +/zh-CN/docs/Web/API/HTMLOrForeignElement/focus /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/focus /zh-CN/docs/Web/API/HTMLOrForeignElement/nonce /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/nonce /zh-CN/docs/Web/API/HTMLOrForeignElement/tabIndex /zh-CN/docs/orphaned/Web/API/HTMLOrForeignElement/tabIndex /zh-CN/docs/Web/API/HTMLTableElement.deleteTHead /zh-CN/docs/Web/API/HTMLTableElement/deleteTHead diff --git a/files/zh-cn/_wikihistory.json b/files/zh-cn/_wikihistory.json index 31bcc5648d..10fc3639cc 100644 --- a/files/zh-cn/_wikihistory.json +++ b/files/zh-cn/_wikihistory.json @@ -15676,24 +15676,6 @@ "lvgx04" ] }, - "Web/API/HTMLOrForeignElement/blur": { - "modified": "2019-03-23T22:00:21.147Z", - "contributors": [ - "teoli", - "fscholz", - "ziyunfei" - ] - }, - "Web/API/HTMLOrForeignElement/focus": { - "modified": "2020-10-15T21:06:47.253Z", - "contributors": [ - "RainSlide", - "slimeball", - "teoli", - "khalid32", - "ziyunfei" - ] - }, "Web/API/HTMLParagraphElement": { "modified": "2020-11-03T10:28:13.003Z", "contributors": [ @@ -49887,6 +49869,14 @@ "teoli" ] }, + "orphaned/Web/API/HTMLOrForeignElement/blur": { + "modified": "2019-03-23T22:00:21.147Z", + "contributors": [ + "teoli", + "fscholz", + "ziyunfei" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/dataset": { "modified": "2019-08-08T12:52:36.012Z", "contributors": [ @@ -49898,6 +49888,16 @@ "ReyCG" ] }, + "orphaned/Web/API/HTMLOrForeignElement/focus": { + "modified": "2020-10-15T21:06:47.253Z", + "contributors": [ + "RainSlide", + "slimeball", + "teoli", + "khalid32", + "ziyunfei" + ] + }, "orphaned/Web/API/HTMLOrForeignElement/nonce": { "modified": "2020-12-05T03:41:17.381Z", "contributors": [ diff --git a/files/zh-cn/orphaned/web/api/htmlorforeignelement/blur/index.html b/files/zh-cn/orphaned/web/api/htmlorforeignelement/blur/index.html new file mode 100644 index 0000000000..98efb73c06 --- /dev/null +++ b/files/zh-cn/orphaned/web/api/htmlorforeignelement/blur/index.html @@ -0,0 +1,25 @@ +--- +title: HTMLElement.blur() +slug: orphaned/Web/API/HTMLOrForeignElement/blur +tags: + - API + - HTML DOM + - HTMLElement + - Method + - Reference +translation_of: Web/API/HTMLOrForeignElement/blur +original_slug: Web/API/HTMLOrForeignElement/blur +--- +

{{ APIRef() }}

+

概述

+

blur方法用来移除当前元素所获得的键盘焦点.

+

语法

+
element.blur()
+
+

规范

+

blur

+

相关链接

+ +

{{ languages( { "fr": "fr/DOM/element.blur", "pl": "pl/DOM/element.blur", "en": "en/DOM/element.blur" } ) }}

diff --git a/files/zh-cn/orphaned/web/api/htmlorforeignelement/focus/index.html b/files/zh-cn/orphaned/web/api/htmlorforeignelement/focus/index.html new file mode 100644 index 0000000000..2e465a6b0a --- /dev/null +++ b/files/zh-cn/orphaned/web/api/htmlorforeignelement/focus/index.html @@ -0,0 +1,159 @@ +--- +title: HTMLElement.focus() +slug: orphaned/Web/API/HTMLOrForeignElement/focus +tags: + - API + - 参考 + - 方法 + - 焦点 +translation_of: Web/API/HTMLOrForeignElement/focus +original_slug: Web/API/HTMLOrForeignElement/focus +--- +
{{ APIRef("HTML DOM") }}
+ +

HTMLElement.focus() 方法用于设置焦点,如果被指定的元素可以获取到焦点,焦点就会被设置到该元素上。得到焦点的元素会作为键盘导航时的当前元素/基准元素,也会接收到相应的键盘事件等事件。

+ +

语法

+ +
element.focus(options); // Object parameter
+ +

参数

+ +
+
options {{optional_inline}}
+
An optional object providing options to control aspects of the focusing process. This object may contain the following property:
+
+
+
preventScroll {{optional_inline}}
+
A Boolean value indicating whether or not the browser should scroll the document to bring the newly-focused element into view. A value of false for preventScroll (the default) means that the browser will scroll the element into view after focusing it. If preventScroll is set to true, no scrolling will occur.
+
+
+
+ +

示例

+ +

将焦点设置到文本框上

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myTextField").focus();
+}
+ +

HTML

+ +
<input type="text" id="myTextField" value="Text field.">
+<p></p>
+<button type="button" onclick="focusMethod()">点这里将焦点设置到文本框上!</button>
+
+ +

结果

+ +

{{ EmbedLiveSample('Focus_on_a_text_field') }}

+ +

将焦点设置到按钮上

+ +

JavaScript

+ +
focusMethod = function getFocus() {
+  document.getElementById("myButton").focus();
+}
+ +

HTML

+ +
<button type="button" id="myButton">Click Me!</button>
+<p></p>
+<button type="button" onclick="focusMethod()">点这里将焦点设置到按钮上!</button>
+ +

结果

+ +

{{ EmbedLiveSample('Focus_on_a_button') }}

+ +

Focus with focusOption

+ +

JavaScript

+ +
focusScrollMethod = function getFocus() {
+  document.getElementById("myButton").focus({preventScroll:false});
+}
+focusNoScrollMethod = function getFocusWithoutScrolling() {
+  document.getElementById("myButton").focus({preventScroll:true});
+}
+
+
+ +

HTML

+ +
<button type="button" onclick="focusScrollMethod()">Click me to focus on the button!</button>
+<button type="button" onclick="focusNoScrollMethod()">Click me to focus on the button without scrolling!</button>
+
+<div id="container" style="height: 1000px; width: 1000px;">
+<button type="button" id="myButton" style="margin-top: 500px;">Click Me!</button>
+</div>
+
+
+ +

结果

+ +

{{ EmbedLiveSample('Focus_prevent_scroll') }}

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
规范状态备注
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
+ +

备注

+ + + +

浏览器兼容性

+ + + +

{{Compat("api.HTMLElement.focus")}}

+ +

参见

+ + diff --git a/files/zh-cn/web/api/htmlorforeignelement/blur/index.html b/files/zh-cn/web/api/htmlorforeignelement/blur/index.html deleted file mode 100644 index a8a3f46e58..0000000000 --- a/files/zh-cn/web/api/htmlorforeignelement/blur/index.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: HTMLElement.blur() -slug: Web/API/HTMLOrForeignElement/blur -tags: - - API - - HTML DOM - - HTMLElement - - Method - - Reference -translation_of: Web/API/HTMLOrForeignElement/blur -original_slug: Web/API/HTMLElement/blur ---- -

{{ APIRef() }}

-

概述

-

blur方法用来移除当前元素所获得的键盘焦点.

-

语法

-
element.blur()
-
-

规范

-

blur

-

相关链接

- -

{{ languages( { "fr": "fr/DOM/element.blur", "pl": "pl/DOM/element.blur", "en": "en/DOM/element.blur" } ) }}

diff --git a/files/zh-cn/web/api/htmlorforeignelement/focus/index.html b/files/zh-cn/web/api/htmlorforeignelement/focus/index.html deleted file mode 100644 index cc8e3f72d9..0000000000 --- a/files/zh-cn/web/api/htmlorforeignelement/focus/index.html +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: HTMLElement.focus() -slug: Web/API/HTMLOrForeignElement/focus -tags: - - API - - 参考 - - 方法 - - 焦点 -translation_of: Web/API/HTMLOrForeignElement/focus -original_slug: Web/API/HTMLElement/focus ---- -
{{ APIRef("HTML DOM") }}
- -

HTMLElement.focus() 方法用于设置焦点,如果被指定的元素可以获取到焦点,焦点就会被设置到该元素上。得到焦点的元素会作为键盘导航时的当前元素/基准元素,也会接收到相应的键盘事件等事件。

- -

语法

- -
element.focus(options); // Object parameter
- -

参数

- -
-
options {{optional_inline}}
-
An optional object providing options to control aspects of the focusing process. This object may contain the following property:
-
-
-
preventScroll {{optional_inline}}
-
A Boolean value indicating whether or not the browser should scroll the document to bring the newly-focused element into view. A value of false for preventScroll (the default) means that the browser will scroll the element into view after focusing it. If preventScroll is set to true, no scrolling will occur.
-
-
-
- -

示例

- -

将焦点设置到文本框上

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myTextField").focus();
-}
- -

HTML

- -
<input type="text" id="myTextField" value="Text field.">
-<p></p>
-<button type="button" onclick="focusMethod()">点这里将焦点设置到文本框上!</button>
-
- -

结果

- -

{{ EmbedLiveSample('Focus_on_a_text_field') }}

- -

将焦点设置到按钮上

- -

JavaScript

- -
focusMethod = function getFocus() {
-  document.getElementById("myButton").focus();
-}
- -

HTML

- -
<button type="button" id="myButton">Click Me!</button>
-<p></p>
-<button type="button" onclick="focusMethod()">点这里将焦点设置到按钮上!</button>
- -

结果

- -

{{ EmbedLiveSample('Focus_on_a_button') }}

- -

Focus with focusOption

- -

JavaScript

- -
focusScrollMethod = function getFocus() {
-  document.getElementById("myButton").focus({preventScroll:false});
-}
-focusNoScrollMethod = function getFocusWithoutScrolling() {
-  document.getElementById("myButton").focus({preventScroll:true});
-}
-
-
- -

HTML

- -
<button type="button" onclick="focusScrollMethod()">Click me to focus on the button!</button>
-<button type="button" onclick="focusNoScrollMethod()">Click me to focus on the button without scrolling!</button>
-
-<div id="container" style="height: 1000px; width: 1000px;">
-<button type="button" id="myButton" style="margin-top: 500px;">Click Me!</button>
-</div>
-
-
- -

结果

- -

{{ EmbedLiveSample('Focus_prevent_scroll') }}

- -

规范

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
规范状态备注
{{SpecName('HTML WHATWG', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'editing.html#focus()-0', 'focus')}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', 'editing.html#dom-focus', 'focus')}}{{Spec2('HTML5 W3C')}}
{{SpecName('DOM2 HTML', 'html.html#ID-32130014', 'focus')}}{{Spec2('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#method-focus', 'focus')}}{{Spec2('DOM1')}}
- -

备注

- - - -

浏览器兼容性

- - - -

{{Compat("api.HTMLElement.focus")}}

- -

参见

- - -- cgit v1.2.3-54-g00ecf