The read-only target
property of the ProcessingInstruction
interface represent the application to which the ProcessingInstruction
is targeted.
For example:
<?xml version="1.0"?>
is a processing instruction whose target
is xml
.
The read-only target
property of the ProcessingInstruction
interface represent the application to which the ProcessingInstruction
is targeted.
For example:
<?xml version="1.0"?>
is a processing instruction whose target
is xml
.
A string containing the name of the application.
let parser = new DOMParser(); const doc = parser.parseFromString('<?xml version="1.0"?><test/>', "application/xml"); const pi = doc.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'); doc.insertBefore(pi, doc.firstChild); const output = document.getElementsByTagName("output")[0]; output.textContent = "This processing instruction's target is: " + doc.firstChild.target;
The processing instruction line will be considered, and represented, as a Comment
object.
<?xml version="1.0"?> <pre></pre>
let node = document.getElementsByTagName("pre")[0].previousSibling.previousSibling; let result = "Node with the processing instruction: " + node.nodeName + ": " + node.nodeValue + "\n"; document.getElementsByTagName("pre")[0].textContent = result;
Specification |
---|
DOM Standard # dom-processinginstruction-target |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
target |
1
|
12
|
1
|
9
|
≤12.1
|
3
|
1
|
18
|
4
|
≤12.1
|
1
|
1.0
|
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction/target