debug - bhsd-harry/wikiparser-node GitHub Wiki

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

// debug (main)
var {firstChild} = Parser.parse('__toc__'),
	token, cloned;
assert.equal(firstChild.type, 'double-underscore');
try {
	firstChild.setText('');
} catch {}
// assert.equal(firstChild, '__toc__');

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');
⚠️ **GitHub.com Fallback** ⚠️