Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions files/en-us/web/api/document/createnodeiterator/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,24 @@ createNodeIterator(root, whatToShow, filter)
It is a convenient way of filtering for certain types of node. It defaults to
`0xFFFFFFFF` representing the `SHOW_ALL` constant.

| Constant | Numerical value | Description |
| -------------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NodeFilter.SHOW_ALL` | `4294967295` (that is the max value of `unsigned long`) | Shows all nodes. |
| `NodeFilter.SHOW_ATTRIBUTE` | `2` | Shows attribute {{ domxref("Attr") }} nodes. This is meaningful only when creating a {{ domxref("TreeWalker") }} with an {{ domxref("Attr") }} node as its root. In this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. |
| `NodeFilter.SHOW_CDATA_SECTION` | `8` | Shows {{ domxref("CDATASection") }} nodes. |
| `NodeFilter.SHOW_COMMENT` | `128` | Shows {{ domxref("Comment") }} nodes. |
| `NodeFilter.SHOW_DOCUMENT` | `256` | Shows {{ domxref("Document") }} nodes. |
| `NodeFilter.SHOW_DOCUMENT_FRAGMENT` | `1024` | Shows {{ domxref("DocumentFragment") }} nodes. |
| `NodeFilter.SHOW_DOCUMENT_TYPE` | `512` | Shows {{ domxref("DocumentType") }} nodes. |
| `NodeFilter.SHOW_ELEMENT` | `1` | Shows {{ domxref("Element") }} nodes. |
| `NodeFilter.SHOW_ENTITY` {{deprecated_inline}} | `32` | Legacy, no more usable. |
| `NodeFilter.SHOW_ENTITY_REFERENCE` {{deprecated_inline}} | `16` | Legacy, no more usable. |
| `NodeFilter.SHOW_NOTATION` {{deprecated_inline}} | `2048` | Legacy, no more usable. |
| `NodeFilter.SHOW_PROCESSING_INSTRUCTION` | `64` | Shows {{ domxref("ProcessingInstruction") }} nodes. |
| `NodeFilter.SHOW_TEXT` | `4` | Shows {{ domxref("Text") }} nodes. |
| Constant | Numerical value | Description |
| -------------------------------------------------------- | --------------- | ------------------------------------------------- |
| `NodeFilter.SHOW_ALL` | `0xFFFFFFFF` | Shows all nodes. |
| `NodeFilter.SHOW_ATTRIBUTE` | `0x2` | Shows {{domxref("Attr")}} nodes. |
| `NodeFilter.SHOW_CDATA_SECTION` | `0x8` | Shows {{domxref("CDATASection")}} nodes. |
| `NodeFilter.SHOW_COMMENT` | `0x80` | Shows {{domxref("Comment")}} nodes. |
| `NodeFilter.SHOW_DOCUMENT` | `0x100` | Shows {{domxref("Document")}} nodes. |
| `NodeFilter.SHOW_DOCUMENT_FRAGMENT` | `0x400` | Shows {{domxref("DocumentFragment")}} nodes. |
| `NodeFilter.SHOW_DOCUMENT_TYPE` | `0x200` | Shows {{domxref("DocumentType")}} nodes. |
| `NodeFilter.SHOW_ELEMENT` | `0x1` | Shows {{domxref("Element")}} nodes. |
| `NodeFilter.SHOW_ENTITY` {{deprecated_inline}} | `0x20` | Legacy, no longer effective. |
| `NodeFilter.SHOW_ENTITY_REFERENCE` {{deprecated_inline}} | `0x10` | Legacy, no longer effective. |
| `NodeFilter.SHOW_NOTATION` {{deprecated_inline}} | `0x800` | Legacy, no longer effective. |
| `NodeFilter.SHOW_PROCESSING_INSTRUCTION` | `0x40` | Shows {{domxref("ProcessingInstruction")}} nodes. |
| `NodeFilter.SHOW_TEXT` | `0x4` | Shows {{domxref("Text")}} nodes. |

> [!NOTE]
> The `NodeFilter.SHOW_ATTRIBUTE` constant is only effective when the root is an attribute node. Since the parent of any `Attr` node is always `null`, {{DOMXref("TreeWalker.nextNode()")}} and {{DOMXref("TreeWalker.previousNode()")}} will never return an `Attr` node. To traverse `Attr` nodes, use {{DOMXref("Element.attributes")}} instead.

- `filter` {{optional_inline}}
- : A callback function or an object with an `acceptNode()` method. The function or method will be called for each node in the subtree based at root which is accepted as included by the whatToShow flag to determine whether or not to include it in the list of iterable nodes. The method should return one of `NodeFilter.FILTER_ACCEPT`, `NodeFilter.FILTER_REJECT`, or `NodeFilter.FILTER_SKIP`. See the [Example](#examples).
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/document/createtreewalker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ createTreeWalker(root, whatToShow, filter)
| `NodeFilter.SHOW_TEXT` | `0x4` | Shows {{domxref("Text")}} nodes. |

> [!NOTE]
> Since the parent of any `Attr` node is always `null`, {{DOMXref("TreeWalker.nextNode()")}} and {{DOMXref("TreeWalker.previousNode()")}} will never return an `Attr` node. To traverse `Attr` nodes, use {{DOMXref("Element.attributes")}} instead.
> The `NodeFilter.SHOW_ATTRIBUTE` constant is only effective when the root is an attribute node. Since the parent of any `Attr` node is always `null`, {{DOMXref("TreeWalker.nextNode()")}} and {{DOMXref("TreeWalker.previousNode()")}} will never return an `Attr` node. To traverse `Attr` nodes, use {{DOMXref("Element.attributes")}} instead.

- `filter` {{optional_inline}}
- : A callback function or an object with an `acceptNode()` method, which returns `NodeFilter.FILTER_ACCEPT`, `NodeFilter.FILTER_REJECT`, or `NodeFilter.FILTER_SKIP`. The function or method will be called for each node in the subtree based at `root` which is accepted as included by the `whatToShow` flag to determine whether or not to include it in the list of iterable nodes:
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/element/sethtml/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ setHTML(input, options)
- : An options object with the following optional parameters:
- `sanitizer`
- : A {{domxref("Sanitizer")}} or {{domxref("SanitizerConfig")}} object which defines what elements of the input will be allowed or removed, or the string `"default"` for the default configuration.
Note that generally a `"Sanitizer` is expected to be more efficient than a `SanitizerConfig` if the configuration is to reused.
Note that generally a `Sanitizer` is expected to be more efficient than a `SanitizerConfig` if the configuration is to be reused.
If not specified, the default sanitizer configuration is used.

### Return value
Expand Down Expand Up @@ -142,7 +142,7 @@ We also define the handler for the reload button.
const unsanitizedString = `
<div>
<p>This is a paragraph. <button onclick="alert('You clicked the button!')">Click me</button></p>
<script src="path/to/a/module.js" type="module"><script>
<script src="path/to/a/module.js" type="module"></script>
</div>
`;

Expand Down
Loading