Skip to content
Bhsd edited this page Nov 21, 2024 · 3 revisions

This is an internal document. For visitors, you can now go back to the home page.

// debug (main)
var {firstChild: {firstChild}} = Parser.parse('[[file:a]]'),
	token, cloned;
assert.equal(firstChild.type, 'link-target');
try {
	firstChild.setText('a');
} catch {}
assert.equal(String(firstChild), 'file:a');

token = Parser.parse('{{{!}}').firstChild;
({firstChild} = token);
assert.equal(firstChild.type, 'table-syntax');
try {
	firstChild.length = 1;
} catch {}
assert.equal(firstChild, '{{{!}}');
firstChild.replaceChildren('{|');
assert.equal(firstChild, '{|');

token = Parser.parse('<gallery>a</gallery>').querySelector('link-target');
try {
	token.append('<');
} catch {}
assert.equal(token, 'a');

token = Parser.parse('-{zh-cn:a}-')
	.querySelector('converter-rule');
({firstChild} = token);
assert.equal(firstChild.type, 'converter-rule-variant');
cloned = firstChild.cloneNode();
cloned.setText('!');
try {
	firstChild.safeReplaceWith(cloned);
} catch {}
assert.equal(token, 'zh-cn:a');
Clone this wiki locally