forked from mdn/translated-content
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fr] fix: Updates to
Web/API/Element/*Attribute*
pages (mdn#19512)
* fix: remove {{DOMAttributeMethods}} macro + add/update Specifications section + add/update Compat section + add/update See also section * Keep old title for now * Update Spécifications title section * fix: flaws * Update Specifications * fix: change *xref to links * fix: flaws * fix: remove "Résumé" title * update: Syntax section * fix: flaws * fix: flaws * fix: flaws for list * Update whole pages vs current en-US state --------- Co-authored-by: SphinxKnight <SphinxKnight@users.noreply.github.com>
- Loading branch information
Showing
12 changed files
with
422 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,57 @@ | ||
--- | ||
title: element.getAttributeNode | ||
title: "Element : méthode getAttributeNode()" | ||
slug: Web/API/Element/getAttributeNode | ||
l10n: | ||
sourceCommit: 7eed0e1e4ab478d78dc7ca23c19ae77406776e4e | ||
--- | ||
|
||
{{ APIRef("DOM") }} | ||
{{APIRef("DOM")}} | ||
|
||
## Résumé | ||
La méthode **`getAttributeNode()`**, associée à l'interface [`Element`](/fr/docs/Web/API/Element), renvoie l'attribut correspondant de l'élément courant sous la forme d'un nœud [`Attr`](/fr/docs/Web/API/Attr). | ||
|
||
Renvoie le nœud d'attribut spécifié pour l'élément courant, en tant que noeud `Attr`. | ||
Cette méthode est utile pour obtenir les [propriétés d'instance](/fr/docs/Web/API/Attr#propriétés) de l'attribut. Si on souhaite seulement obtenir la valeur de l'attribut, on pourra plutôt utiliser la méthode [`getAttribute()`](/fr/docs/Web/API/Element/getAttribute). | ||
|
||
## Syntaxe | ||
|
||
```js | ||
var attrNode = element.getAttributeNode(attrName); | ||
```js-nolint | ||
getAttributeNode(attrName) | ||
``` | ||
|
||
- `attrNode` est un nœud `Attr` pour l'attribut demandé. | ||
- `attrName` est une chaîne de caractères qui contient le nom de l'attribut. | ||
### Paramètres | ||
|
||
- `attrName` | ||
- : Une chaîne de caractères qui contient le nom de l'attribut recherché. | ||
|
||
### Valeur de retour | ||
|
||
Un nœud [`Attr`](/fr/docs/Web/API/Attr) pour l'attribut demandé. | ||
|
||
## Exemple | ||
## Exemples | ||
|
||
```js | ||
// html: <div id="top" /> | ||
var t = document.getElementById("top"); | ||
var idAttr = t.getAttributeNode("id"); | ||
alert(idAttr.value == "top"); | ||
let t = document.getElementById("top"); | ||
let idAttr = t.getAttributeNode("id"); | ||
console.log(idAttr.value === "top"); | ||
``` | ||
|
||
## Notes | ||
|
||
Lorsqu'elle est appelée sur un élément HTML dans un DOM marqué comme un document HTML, `getAttributeNode` passe en minuscules son argument avant de continuer. | ||
Lorsque cette méthode est appelée sur un élément HTML dans un DOM marqué comme un document HTML, elle transforme son argument en minuscules avant de continuer. | ||
|
||
Les nœuds `Attr` héritent de `Node`, mais ne sont pas considérés comme faisant partie de l'arbre du document. Les attributs habituels des nœuds comme [`parentNode`](/fr/docs/Web/API/Node/parentNode), [`previousSibling`](/fr/docs/Web/API/Node/previousSibling), et [`nextSibling`](/fr/docs/Web/API/Node/nextSibling) sont `null` pour un nœud `Attr`. Vous pouvez cependant accéder à l'élément auquel cet attribut appartient grâce à la propriété `ownerElement`. | ||
|
||
## Spécifications | ||
|
||
{{Specifications}} | ||
|
||
Les nœuds `Attr` héritent de `Node`, mais ne sont pas considérés comme faisant partie de l'arbre du document. Les attributs habituels des nœuds comme [parentNode](/fr/DOM/element.parentNode), [previousSibling](/fr/DOM/element.previousSibling), et [nextSibling](/fr/DOM/element.nextSibling) sont `null` pour un nœud `Attr`. Vous pouvez cependant accéder à l'élément auquel cet attribut appartient grâce à la propriété `ownerElement`. | ||
## Compatibilité des navigateurs | ||
|
||
[getAttribute](/fr/DOM/element.getAttribute) est habituellement utilisé à la place de `getAttributeNode` pour obtenir la valeur d'un attribut d'un élément. | ||
{{Compat}} | ||
|
||
## Spécification | ||
## Voir aussi | ||
|
||
- [DOM Level 2 Core : getAttributeNode](http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-217A91B8) — [traduction en français](http://www.yoyodesign.org/doc/w3c/dom2-core/core.html#ID-217A91B8) (non normative) | ||
- [HTML 5: APIs in HTML documents](http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#apis-in-html-documents) | ||
- [`Document.createAttribute()`](/fr/docs/Web/API/Document/createAttribute) | ||
- [`Element.setAttributeNode()`](/fr/docs/Web/API/Element/setAttributeNode) | ||
- [`Element.removeAttributeNode()`](/fr/docs/Web/API/Element/removeAttributeNode) | ||
- [`Element.getAttributeNodeNS()`](/fr/docs/Web/API/Element/getAttributeNodeNS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,51 @@ | ||
--- | ||
title: element.getAttributeNodeNS | ||
title: "Element : méthode getAttributeNodeNS()" | ||
slug: Web/API/Element/getAttributeNodeNS | ||
l10n: | ||
sourceCommit: 7eed0e1e4ab478d78dc7ca23c19ae77406776e4e | ||
--- | ||
|
||
{{ ApiRef() }} | ||
{{APIRef("DOM")}} | ||
|
||
### Résumé | ||
La méthode **`getAttributeNodeNS()`**, associée à l'interface [`Element`](/fr/docs/Web/API/Element), renvoie le nœud [`Attr`](/fr/docs/Web/API/Attr) de l'élément courant avec l'espace de noms et le nom donnés. | ||
|
||
Renvoie le nœud `Attr` pour l'attribut avec l'espace de noms et le nom donnés. | ||
Cette méthode est utile pour obtenir les [propriétés d'instance](/fr/docs/Web/API/Attr#propriétés) de l'attribut. Si on souhaite seulement obtenir la valeur de l'attribut de l'espace de noms, on pourra plutôt utiliser la méthode [`getAttributeNS()`](/fr/docs/Web/API/Element/getAttributeNS). | ||
|
||
### Syntaxe | ||
Si on souhaite obtenir le nœud [`Attr`](/fr/docs/Web/API/Attr) d'un élément HTML et que cet attribut n'est pas dans un espace de noms, on utilisera plutôt la méthode | ||
[`getAttributeNode()`](/fr/docs/Web/API/Element/getAttributeNode). | ||
|
||
```js | ||
attributeNode = element.getAttributeNodeNS(namespace, nodeName); | ||
## Syntaxe | ||
|
||
```js-nolint | ||
getAttributeNodeNS(namespace, nodeName) | ||
``` | ||
|
||
### Paramètres | ||
|
||
- `attributeNode` | ||
- : Le nœud pour l'attribut spécifié. | ||
- `namespace` | ||
- : Une chaîne spécifiant l'espace de noms de l'attribut. | ||
- `nodeName` | ||
- : Une chaîne spécifiant le nom de l'attribut. | ||
|
||
\== Example == TBD The example needs to be fixed // html: \<div id="top" /> t = document.getElementById("top"); specialNode = t.getAttributeNodeNS( "<http://www.mozilla.org/ns/specialspace>", "id"); // iNode.value = "full-top" | ||
### Valeur de retour | ||
|
||
Le nœud [`Attr`](/fr/docs/Web/API/Attr) pour l'attribut spécifié. | ||
|
||
## Notes | ||
|
||
`getAttributeNodeNS()` est plus spécifique que [`Element.getAttributeNode()`](/fr/docs/Web/API/Element/getAttributeNode), car il permet de spécifier les attributs faisant partie d'un espace de noms donné. Le mutateur correspondant à cet accesseur est [`Element.setAttributeNodeNS()`](/fr/docs/Web/API/Element/setAttributeNodeNS). | ||
|
||
## Spécifications | ||
|
||
{{Specifications}} | ||
|
||
### Notes | ||
## Compatibilité des navigateurs | ||
|
||
`getAttributeNodeNS` est plus spécifique que {{ domxref("Element.getAttributeNode") }} en ce qu'il permet de spécifier les attributs faisant partis d'un espace de noms particulier. La méthode de réglage correspondante est {{ domxref("Element.setAttributeNodeNS") }}. | ||
{{Compat}} | ||
|
||
### Spécification | ||
## Voir aussi | ||
|
||
- [DOM Level 2 Core: getAttributeNodeNS (en)](http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElGetAtNodeNS) — [traduction en français](http://www.yoyodesign.org/doc/w3c/dom2-core/core.html#ID-ElGetAtNodeNS) (non normative) | ||
- [`Element.getAttributeNode()`](/fr/docs/Web/API/Element/getAttributeNode) | ||
- [`Document.createAttribute()`](/fr/docs/Web/API/Document/createAttribute) | ||
- [`Document.createAttributeNS()`](/fr/docs/Web/API/Document/createAttributeNS) | ||
- [`Element.setAttributeNodeNS()`](/fr/docs/Web/API/Element/setAttributeNodeNS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.