Elysia Tools
Navigation
Security
Inert text display training
Practice literal text assignment, code-point truncation and bounded text joining with inert entity-only fixtures.
Samples
Entries inside this sample collection
Assign an inert text field
The plain object models textContent, not HTML parsing. The entity text stays literal; no browser or DOM is used.
// A plain-object teaching model, not a DOM node.
function textModel(value) {
if (typeof value !== 'string' || value.length > 32) return null;
const node = { textContent: '' };
node.textContent = value;
return node;
}
const result = textModel('&');
console.log(JSON.stringify(result));Bound a plain-text preview
Keep the first four Unicode code points of the short fixture. This is truncation, not entity decoding or sanitization.
function preview(value) {
if (typeof value !== 'string' || value.length > 32) return null;
return Array.from(value).slice(0, 4).join('');
}
const result = preview('&');
console.log(JSON.stringify(result));Join text-only parts
Join two bounded entity-only strings into a text field. No markup interpreter, script or event handler exists in this model.
function joinText(parts) {
if (!Array.isArray(parts) || parts.length > 3) return null;
if (!parts.every(p => typeof p === 'string' && p.length <= 12)) return null;
return { textContent: parts.join(' ') };
}
const result = joinText(['&', '<']);
console.log(JSON.stringify(result));Tools
Tools frequently paired with this sample
Related
Related sample collections
Related