diff --git a/files/en-us/web/api/document/createnodeiterator/index.md b/files/en-us/web/api/document/createnodeiterator/index.md index 439ed72cb334341..5e43d62cc141352 100644 --- a/files/en-us/web/api/document/createnodeiterator/index.md +++ b/files/en-us/web/api/document/createnodeiterator/index.md @@ -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). diff --git a/files/en-us/web/api/document/createtreewalker/index.md b/files/en-us/web/api/document/createtreewalker/index.md index 279b1781c1225bc..73579bb5524c5b5 100644 --- a/files/en-us/web/api/document/createtreewalker/index.md +++ b/files/en-us/web/api/document/createtreewalker/index.md @@ -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: diff --git a/files/en-us/web/api/element/sethtml/index.md b/files/en-us/web/api/element/sethtml/index.md index 5bd0f236d987b48..ca4dc2e7698cd88 100644 --- a/files/en-us/web/api/element/sethtml/index.md +++ b/files/en-us/web/api/element/sethtml/index.md @@ -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 @@ -142,7 +142,7 @@ We also define the handler for the reload button. const unsanitizedString = `

This is a paragraph.

-
`; diff --git a/files/en-us/web/api/nodeiterator/index.md b/files/en-us/web/api/nodeiterator/index.md index b2e66e87f03ac71..06f39be86f8f4bf 100644 --- a/files/en-us/web/api/nodeiterator/index.md +++ b/files/en-us/web/api/nodeiterator/index.md @@ -25,25 +25,6 @@ _This interface doesn't inherit any property._ - {{domxref("NodeIterator.whatToShow")}} {{ReadOnlyInline}} - : Returns an `unsigned long` bitmask that describes the types of {{domxref("Node")}} to be matched. Non-matching nodes are skipped, but relevant child nodes may be included. - - The possible bitmask values are constants from the `NodeFilter` interface: - - | Constant | Numerical value | Description | - | -------------------------------------------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | `NodeFilter.SHOW_ALL` | `4294967295` (that is the max value of `unsigned long`) | Shows all nodes. | - | `NodeFilter.SHOW_ATTRIBUTE` {{deprecated_inline}} | `2` | Shows attribute {{ domxref("Attr") }} nodes. This is meaningful only when creating a `NodeIterator` 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` {{deprecated_inline}} | `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 longer used. | - | `NodeFilter.SHOW_ENTITY_REFERENCE` {{deprecated_inline}} | `16` | Legacy, no longer used. | - | `NodeFilter.SHOW_NOTATION` {{deprecated_inline}} | `2048` | Legacy, no longer used. | - | `NodeFilter.SHOW_PROCESSING_INSTRUCTION` | `64` | Shows {{domxref("ProcessingInstruction")}} nodes. | - | `NodeFilter.SHOW_TEXT` | `4` | Shows {{domxref("Text") }} nodes. | - - {{domxref("NodeIterator.filter")}} {{ReadOnlyInline}} - : Returns a `NodeFilter` used to select the relevant nodes. - {{domxref("NodeIterator.referenceNode")}} {{ReadOnlyInline}} diff --git a/files/en-us/web/api/nodeiterator/whattoshow/index.md b/files/en-us/web/api/nodeiterator/whattoshow/index.md index ee2fd46a894cacb..da5361ed519e693 100644 --- a/files/en-us/web/api/nodeiterator/whattoshow/index.md +++ b/files/en-us/web/api/nodeiterator/whattoshow/index.md @@ -14,105 +14,7 @@ should be returned by the {{domxref("NodeIterator")}}. ## Value -An `unsigned integer`. - -The values that can be combined to form the bitmask are: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConstantNumerical valueDescription
NodeFilter.SHOW_ALL - 4294967295 (that is the max value of unsigned long) - Shows all nodes.
- NodeFilter.SHOW_ATTRIBUTE {{deprecated_inline}} - 2 - Shows attribute {{ domxref("Attr") }} nodes. This is meaningful - only when creating a {{ domxref("NodeIterator") }} or - {{ 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 {{deprecated_inline}} - 8Shows {{ domxref("CDATASection") }} nodes.
NodeFilter.SHOW_COMMENT128Shows {{ domxref("Comment") }} nodes.
NodeFilter.SHOW_DOCUMENT256Shows {{ domxref("Document") }} nodes.
NodeFilter.SHOW_DOCUMENT_FRAGMENT1024Shows {{ domxref("DocumentFragment") }} nodes.
NodeFilter.SHOW_DOCUMENT_TYPE512Shows {{ domxref("DocumentType") }} nodes.
NodeFilter.SHOW_ELEMENT1Shows {{ domxref("Element") }} nodes.
NodeFilter.SHOW_ENTITY {{deprecated_inline}}32Legacy, no more used.
- NodeFilter.SHOW_ENTITY_REFERENCE - {{deprecated_inline}} - 16Legacy, no more used.
- NodeFilter.SHOW_NOTATION {{deprecated_inline}} - 2048Legacy, no more used.
NodeFilter.SHOW_PROCESSING_INSTRUCTION64Shows {{ domxref("ProcessingInstruction") }} nodes.
NodeFilter.SHOW_TEXT4Shows {{ domxref("Text") }} nodes.
+A non-negative integer. For the list of possible values, see [`document.createNodeIterator()`](/en-US/docs/Web/API/Document/createNodeIterator#whattoshow). ## Examples diff --git a/files/en-us/web/api/performance_api/resource_timing/index.md b/files/en-us/web/api/performance_api/resource_timing/index.md index fd3dc5071dab059..cdc102ed614f8b5 100644 --- a/files/en-us/web/api/performance_api/resource_timing/index.md +++ b/files/en-us/web/api/performance_api/resource_timing/index.md @@ -12,26 +12,16 @@ Every resource on a document will be represented by a {{domxref("PerformanceReso For each `PerformanceResourceTiming` entry, a _resource loading timeline_ will be recorded, with {{domxref("DOMHighResTimeStamp","high-resolution timestamps", "", 1)}} for network events such as redirect start and end times, DNS lookup start and end times, request start, response start and end times, and so on. Besides the timestamps, other properties that provide information about the resource are included as well, such the size of the fetched resource, or the type of resource that initiated the fetch. +See [Typical resource timing metrics](/en-US/docs/Web/API/PerformanceResourceTiming#typical_resource_timing_metrics) in the reference page for the {{domxref("PerformanceResourceTiming")}} interface. + ## Resource loading timestamps ![Timestamp diagram listing timestamps in the order in which they are recorded for the fetching of a resource](https://mdn.github.io/shared-assets/images/diagrams/api/performance/timestamp-diagram.svg) Figure 1. Resource loading timestamps ([source](https://w3c.github.io/resource-timing/#attribute-descriptions)). -An application can get timestamps for the various stages used to load a resource. The timestamps this API provides are: - -1. {{domxref("PerformanceEntry.startTime","startTime")}}: timestamp immediately before the resource loading process begins. -2. {{domxref("PerformanceResourceTiming.redirectStart","redirectStart")}}: timestamp of the fetch which initiates the redirect. -3. {{domxref("PerformanceResourceTiming.redirectEnd","redirectEnd")}}: timestamp immediately after receiving the last byte of the response to the last redirect. -4. {{domxref('PerformanceResourceTiming.workerStart','workerStart')}}: timestamp immediately before starting the Service Worker thread. -5. {{domxref("PerformanceResourceTiming.fetchStart","fetchStart")}}: timestamp immediately before the browser starts to fetch the resource. -6. {{domxref("PerformanceResourceTiming.domainLookupStart","domainLookupStart")}}: timestamp immediately before the browser starts the domain name lookup for the resource. -7. {{domxref("PerformanceResourceTiming.domainLookupEnd","domainLookupEnd")}}: timestamp immediately after the browser finishes the domain name lookup for the resource. -8. {{domxref('PerformanceResourceTiming.connectStart','connectStart')}}: timestamp immediately before the user agent starts establishing the connection to the server to retrieve the resource. -9. {{domxref('PerformanceResourceTiming.secureConnectionStart','secureConnectionStart')}}: If the resource is loaded via a secure connection, timestamp immediately before the browser starts the handshake process to secure the current connection. -10. {{domxref('PerformanceResourceTiming.connectEnd','connectEnd')}}: timestamp immediately after the browser finishes establishing the connection to the server to retrieve the resource. -11. {{domxref('PerformanceResourceTiming.requestStart','requestStart')}}: timestamp of the time immediately before the browser starts requesting the resource from the server, cache, or local resource. -12. {{domxref('PerformanceResourceTiming.responseStart','responseStart')}}: timestamp immediately after the browser receives the first byte of the response from the server, cache, or local resource. -13. {{domxref('PerformanceResourceTiming.responseEnd','responseEnd')}}: timestamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. +An application can get timestamps for the various stages used to load a resource. For example the {{domxref('PerformanceEntry.startTime','startTime')}}, DNS timestamps, connection set up times and then various resource download times. + +See [timestamps](/en-US/docs/Web/API/PerformanceResourceTiming#timestamps) in the reference page for the {{domxref("PerformanceResourceTiming")}} interface. ## Resource size @@ -43,49 +33,6 @@ The {{domxref('PerformanceResourceTiming.encodedBodySize','encodedBodySize')}} p The {{domxref("PerformanceResourceTiming")}} interface provides [additional resources information](/en-US/docs/Web/API/PerformanceResourceTiming#additional_resource_information). Consult the reference docs for the full list of properties. -## Typical resource timing metrics - -The information the `PerformanceResourceTiming` entries provide are often used for calculations like the following: - -- Measuring TCP handshake time (`connectEnd` - `connectStart`) -- Measuring DNS lookup time (`domainLookupEnd` - `domainLookupStart`) -- Measuring redirection time (`redirectEnd` - `redirectStart`) -- Measuring request time (`responseStart` - `requestStart`) -- Measuring TLS negotiation time (`requestStart` - `secureConnectionStart`) -- Measuring time to fetch (without redirects) (`responseEnd` - `fetchStart`) -- Measuring ServiceWorker processing time (`fetchStart` - `workerStart`) -- Checking if content was compressed (`decodedBodySize` should not be `encodedBodySize`) -- Checking if local caches were hit (`transferSize` should be `0`) -- Checking if modern and fast protocols are used (`nextHopProtocol` should be HTTP/2 or HTTP/3) -- Checking if the correct resources are render-blocking (`renderBlockingStatus`) - -The {{domxref("PerformanceResourceTiming")}} reference pages contain example code for measuring all of these metrics. Typically, the code for measuring these metrics looks like this: - -```js -const observer = new PerformanceObserver((list) => { - list.getEntries().forEach((entry) => { - const request = entry.responseStart - entry.requestStart; - if (request > 0) { - console.log(`${entry.name}: Request time: ${request}ms`); - } - }); -}); - -observer.observe({ type: "resource", buffered: true }); -``` - -## Cross-origin timing information - -When {{Glossary("CORS")}} is in effect, many of the timing properties' values are returned as zero unless the server's access policy permits these values to be shared. This requires the server providing the resource to send the {{httpheader("Timing-Allow-Origin")}} HTTP response header with a value specifying the origin or origins which are allowed to get the restricted timestamp values. - -The properties which are returned as 0 by default when loading a resource from an origin other than the one of the web page itself: `redirectStart`, `redirectEnd`, `domainLookupStart`, `domainLookupEnd`, `connectStart`, `connectEnd`, `secureConnectionStart`, `requestStart`, and `responseStart`. - -For example, to allow `https://developer.mozilla.org` to see resource timing information, the cross-origin resource should send: - -```http -Timing-Allow-Origin: https://developer.mozilla.org -``` - ## Managing resource buffer sizes If your website or application fetches more than 250 resources and you want to record more than 250 {{domxref("PerformanceResourceTiming")}} entries, you need to increase the size of the resource timing buffer. @@ -102,6 +49,12 @@ performance.setResourceTimingBufferSize(500); For more information, see also [Managing buffer sizes](/en-US/docs/Web/API/Performance_API/Performance_data#managing_buffer_sizes). +## Cross-origin timing information + +Many of the resource timing properties are restricted to return `0` or an empty string when the resource is a cross-origin request. To expose cross-origin timing information, the {{HTTPHeader("Timing-Allow-Origin")}} HTTP response header needs to be set. + +For more information on the fields affected, see [Cross-origin timing information](/en-US/docs/Web/API/PerformanceResourceTiming#cross-origin_timing_information) in the reference page for the {{domxref("PerformanceResourceTiming")}} interface. + ## See also - {{domxref("PerformanceResourceTiming")}} diff --git a/files/en-us/web/api/performanceresourcetiming/index.md b/files/en-us/web/api/performanceresourcetiming/index.md index dcd14d2ab1b90a2..d5cbd9432b73a33 100644 --- a/files/en-us/web/api/performanceresourcetiming/index.md +++ b/files/en-us/web/api/performanceresourcetiming/index.md @@ -24,6 +24,7 @@ The properties of this interface allow you to calculate certain resource timing - Measuring redirection time (`redirectEnd` - `redirectStart`) - Measuring interim request time (`firstInterimResponseStart` - `finalResponseHeadersStart`) - Measuring request time (`responseStart` - `requestStart`) +- Measuring document request time (`finalResponseHeadersStart` - `requestStart`) - Measuring TLS negotiation time (`requestStart` - `secureConnectionStart`) - Measuring time to fetch (without redirects) (`responseEnd` - `fetchStart`) - Measuring ServiceWorker processing time (`fetchStart` - `workerStart`) @@ -32,6 +33,22 @@ The properties of this interface allow you to calculate certain resource timing - Checking if modern and fast protocols are used (`nextHopProtocol` should be HTTP/2 or HTTP/3) - Checking if the correct resources are render-blocking (`renderBlockingStatus`) +### Managing resource buffer sizes + +By default only 250 resource timing entries are buffered. For more information see the [resource buffer sizes](/en-US/docs/Web/API/Performance_API/Resource_timing#managing_resource_buffer_sizes) of the Resource Timing guide. + +### Cross-origin timing information + +Many of the resource timing properties are restricted to return `0` or an empty string when the resource is a cross-origin request. To expose cross-origin timing information, the {{HTTPHeader("Timing-Allow-Origin")}} HTTP response header needs to be set. + +The properties which are returned as `0` by default when loading a resource from an origin other than the one of the web page itself: `redirectStart`, `redirectEnd`, `domainLookupStart`, `domainLookupEnd`, `connectStart`, `connectEnd`, `secureConnectionStart`, `requestStart`, and `responseStart`. + +For example, to allow `https://developer.mozilla.org` to see resource timing information, the cross-origin resource should send: + +```http +Timing-Allow-Origin: https://developer.mozilla.org +``` + ## Instance properties ### Inherited from `PerformanceEntry` @@ -137,18 +154,6 @@ resources.forEach((entry) => { }); ``` -## Security requirements - -### Cross-origin timing information - -Many of the resource timing properties are restricted to return `0` or an empty string when the resource is a cross-origin request. To expose cross-origin timing information, the {{HTTPHeader("Timing-Allow-Origin")}} HTTP response header needs to be set. - -For example, to allow `https://developer.mozilla.org` to see resource timing information, the cross-origin resource should send: - -```http -Timing-Allow-Origin: https://developer.mozilla.org -``` - ## Specifications {{Specifications}} diff --git a/files/en-us/web/api/readablestream/readablestream/index.md b/files/en-us/web/api/readablestream/readablestream/index.md index 796a969feab2214..89157ad22d080d4 100644 --- a/files/en-us/web/api/readablestream/readablestream/index.md +++ b/files/en-us/web/api/readablestream/readablestream/index.md @@ -72,7 +72,7 @@ new ReadableStream(underlyingSource, queuingStrategy) - : An object that optionally defines a queuing strategy for the stream. This takes two parameters: - `highWaterMark` - - : A non-negative integer — this defines the total number of chunks that can be + - : A non-negative integer — this defines the total size of all chunks that can be contained in the internal queue before backpressure is applied. - `size(chunk)` - : A method containing a parameter `chunk` — this indicates the size to diff --git a/files/en-us/web/api/treewalker/index.md b/files/en-us/web/api/treewalker/index.md index 6e06e563eddf401..4f204ad6d1d7618 100644 --- a/files/en-us/web/api/treewalker/index.md +++ b/files/en-us/web/api/treewalker/index.md @@ -18,24 +18,7 @@ _This interface doesn't inherit any property._ - {{domxref("TreeWalker.root")}} {{ReadOnlyInline}} - : Returns the root {{domxref("Node")}} as specified when the `TreeWalker` was created. - {{domxref("TreeWalker.whatToShow")}} {{ReadOnlyInline}} - - : Returns an `unsigned long` being a bitmask made of constants describing the types of {{domxref("Node")}} that must be presented. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are: - - | Constant | Numerical value | Description | - | -------------------------------------------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | `NodeFilter.SHOW_ALL` | `4294967295` (that is the max value of `unsigned long`) | Shows all nodes. | - | `NodeFilter.SHOW_ATTRIBUTE` {{deprecated_inline}} | `2` | Shows attribute {{ domxref("Attr") }} nodes. This is meaningful only when creating a `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` {{deprecated_inline}} | `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. | - + - : Returns an `unsigned long` which is a bitmask made of constants describing the types of {{domxref("Node")}} that must be presented. Non-matching nodes are skipped, but their children may be included, if relevant. - {{domxref("TreeWalker.filter")}} {{ReadOnlyInline}} - : Returns the `NodeFilter` associated with this `TreeWalker` used to select the relevant nodes. - {{domxref("TreeWalker.currentNode")}} diff --git a/files/en-us/web/api/treewalker/whattoshow/index.md b/files/en-us/web/api/treewalker/whattoshow/index.md index 18d795b361b34f3..caf3e080d8336d2 100644 --- a/files/en-us/web/api/treewalker/whattoshow/index.md +++ b/files/en-us/web/api/treewalker/whattoshow/index.md @@ -11,106 +11,11 @@ browser-compat: api.TreeWalker.whatToShow The **`TreeWalker.whatToShow`** read-only property returns a bitmask that indicates the types of [nodes](/en-US/docs/Web/API/Node) to show. Non-matching nodes are skipped, but their -children may be included, if relevant. The possible values are: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConstantNumerical valueDescription
NodeFilter.SHOW_ALL - 4294967295 (that is the max value of unsigned long) - Shows all nodes.
- NodeFilter.SHOW_ATTRIBUTE {{deprecated_inline}} - 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 {{deprecated_inline}} - 8Shows {{ domxref("CDATASection") }} nodes.
NodeFilter.SHOW_COMMENT128Shows {{ domxref("Comment") }} nodes.
NodeFilter.SHOW_DOCUMENT256Shows {{ domxref("Document") }} nodes.
NodeFilter.SHOW_DOCUMENT_FRAGMENT1024Shows {{ domxref("DocumentFragment") }} nodes.
NodeFilter.SHOW_DOCUMENT_TYPE512Shows {{ domxref("DocumentType") }} nodes.
NodeFilter.SHOW_ELEMENT1Shows {{ domxref("Element") }} nodes.
NodeFilter.SHOW_ENTITY {{deprecated_inline}}32Legacy, no more used.
- NodeFilter.SHOW_ENTITY_REFERENCE - {{deprecated_inline}} - 16Legacy, no more used.
- NodeFilter.SHOW_NOTATION {{deprecated_inline}} - 2048Legacy, no more used.
NodeFilter.SHOW_PROCESSING_INSTRUCTION64Shows {{ domxref("ProcessingInstruction") }} nodes.
NodeFilter.SHOW_TEXT4Shows {{ domxref("Text") }} nodes.
+children may be included, if relevant. ## Value -A bitmask. +A non-negative integer. For the list of possible values, see [`document.createTreeWalker()`](/en-US/docs/Web/API/Document/createTreeWalker#whattoshow). ## Examples diff --git a/package.json b/package.json index ceb52b742ddcbc8..03993719b2ac73e 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "dependencies": { "@apideck/better-ajv-errors": "^0.3.6", "@caporal/core": "^2.0.7", - "@mdn/fred": "1.6.2", + "@mdn/fred": "1.7.0", "@octokit/rest": "^22.0.0", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", diff --git a/yarn.lock b/yarn.lock index 4b3b4d1139be3dc..c0ba8eb4ff480fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -738,10 +738,10 @@ resolved "https://registry.yarnpkg.com/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz#775374306116d51c0c500b8c4face0f9a04752d8" integrity sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g== -"@mdn/fred@1.6.2": - version "1.6.2" - resolved "https://registry.yarnpkg.com/@mdn/fred/-/fred-1.6.2.tgz#5fce4f06d6377924a5a3ef63a3b7fbe83e243777" - integrity sha512-eFhMNQZSxHlRnzkhV582HuQxqLRfQmKxjp0kdE6BDJBT+rKJONutRK07jSpaDuITtqfaF2zoQgVa5mdeeDMKsw== +"@mdn/fred@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@mdn/fred/-/fred-1.7.0.tgz#8dc9ad6e282206d56f3b4cef4f3fc4078605020a" + integrity sha512-zhowSHkIc4i+LY78YDGdp7zDlPLI452zqS87HEPQhy0FRKBuAqi+tJ5n0rNqxIevUSnZh8iU88Z8DYLOQtHWFA== dependencies: "@codemirror/lang-css" "^6.3.1" "@codemirror/lang-html" "^6.4.11" @@ -753,7 +753,7 @@ "@lit-labs/ssr" "^3.3.1" "@lit-labs/ssr-client" "^1.1.7" "@lit/task" "^1.0.3" - "@mdn/rari" "0.1.52" + "@mdn/rari" "0.1.53" "@mdn/watify" "^1.1.3" "@mozilla/glean" "^5.0.6" codemirror "^6.0.1" @@ -772,10 +772,10 @@ prismjs "^1.29.0" source-map-support "^0.5.21" -"@mdn/rari@0.1.52": - version "0.1.52" - resolved "https://registry.yarnpkg.com/@mdn/rari/-/rari-0.1.52.tgz#1c07852737d4d1979bdfb718534042b3c70be40f" - integrity sha512-mrjix5rJ1nlyLNp1lrsQcZ8OlX+RqHECEtGNcNvuH32vJVzPZI7H2dngH9uQ349TrW2dXCgt8goinsIOTPa/Aw== +"@mdn/rari@0.1.53": + version "0.1.53" + resolved "https://registry.yarnpkg.com/@mdn/rari/-/rari-0.1.53.tgz#91808a8ecb1c3238a27e56b200788ef70fdca6a8" + integrity sha512-iBXkJGwk9t6Oi2QFcTD2KSt6KHlJWDp9yodPgCqHuyghp/Yo0+4I48bsFWcqJ59vBg3ff+HUFcz4hY6KiUbl+A== dependencies: extract-zip "^2.0.1" https-proxy-agent "^7.0.2"