Skip to content

OnlyincludeToken

bhsd edited this page Nov 25, 2023 · 13 revisions

简介

<onlyinclude></onlyinclude>包裹的内容。仅在嵌入时(即 Parser.parse(text, true))生效。

以下所有属性和方法在 MiniBrowser 版本中均不可用。

Properties

innerText

type: string
内部wikitext,只读。

var {firstChild} = Parser.parse('<onlyinclude>a</onlyinclude>', true);
assert.equal(firstChild, '<onlyinclude>a</onlyinclude>');
assert.strictEqual(firstChild.innerText, 'a');

Methods

cloneNode

returns: this
深拷贝节点。

var {firstChild} = Parser.parse('<onlyinclude>a</onlyinclude>', true),
	cloned = firstChild.cloneNode();
assert.equal(firstChild, '<onlyinclude>a</onlyinclude>');
assert.equal(cloned, '<onlyinclude>a</onlyinclude>');
assert.deepStrictEqual(cloned, firstChild);
Clone this wiki locally