A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/zh-CN/docs/Web/API/Document/createProcessingInstruction below:

Document:createProcessingInstruction() 方法 - Web API

Document:createProcessingInstruction() 方法

Baseline Widely available

createProcessingInstruction() 生成新的处理指令节点并返回。

新节点通常会被插入 XML 文档,以便完成任何操作,例如 node.insertBefore。

语法
createProcessingInstruction(target, data)
参数 返回值

无(undefined)。

异常
InvalidCharacterError DOMException

如果满足以下任意条件,则抛出该异常:

示例
const doc = new DOMParser().parseFromString("<foo />", "application/xml");
const pi = doc.createProcessingInstruction(
  "xml-stylesheet",
  'href="mycss.css"',
);

doc.insertBefore(pi, doc.firstChild);

console.log(new XMLSerializer().serializeToString(doc));
// 显示:<?xml-stylesheet href="mycss.css" type="text/css"?><foo/>
规范 浏览器兼容性

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4