How to use slimdom - 10 common examples

To help you get started, we’ve selected a few slimdom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FontoXML / fontoxpath / test / specs / parsing / functions / functions.string.tests.ts View on Github external
it('regards CDATA childnodes as text nodes', () => {
			const document = new slimdom.Document();
			var element = document.appendChild(document.createElement('test'));
			element.appendChild(document.createTextNode('Some '));
			element.appendChild(document.createCDATASection(''));
			chai.assert.equal(evaluateXPathToString('string()', document), 'Some ');
		});
github FontoXML / fontoxpath / test / specs / parsing / functions / functions.string.tests.ts View on Github external
it('regards CDATA nodes as text nodes', () => {
			const document = new slimdom.Document();
			var element = document.appendChild(document.createElement('test'));
			element.appendChild(document.createTextNode('Some '));
			element.appendChild(document.createCDATASection(''));
			chai.assert.equal(
				evaluateXPathToString('string()', document.documentElement),
				'Some '
			);
		});
github FontoXML / fontoxpath / test / specs / parsing / getBucketsForNode.tests.js View on Github external
import chai from 'chai';
import { getBucketsForNode } from 'fontoxpath';
import * as slimdom from 'slimdom';
const doc = new slimdom.Document();
describe('getBucketsForNode', () => {
	it('returns the correct buckets for elements', () => {
		chai.assert.deepEqual(getBucketsForNode(doc.createElement('element')), ['type-1', 'name-element']);
	});
	it('returns the correct buckets for text nodes', () => {
		chai.assert.deepEqual(getBucketsForNode(doc.createTextNode('A piece of text')), ['type-3']);
	});
});
github FontoXML / fontoxpath / test / specs / parsing / getBucketsForNode.tests.ts View on Github external
import * as chai from 'chai';
import { getBucketsForNode } from 'fontoxpath';
import * as slimdom from 'slimdom';
const doc = new slimdom.Document();
describe('getBucketsForNode', () => {
	it('returns the correct buckets for elements', () => {
		chai.assert.deepEqual(getBucketsForNode(doc.createElement('element')), [
			'type-1',
			'name-element'
		]);
	});
	it('returns the correct buckets for text nodes', () => {
		chai.assert.deepEqual(getBucketsForNode(doc.createTextNode('A piece of text')), ['type-3']);
	});
});
github FontoXML / fontoxpath / test / specs / parsing / operators / boolean / AndOperator.tests.ts View on Github external
it('can optimize an and expression with buckets', () => {
		chai.assert.isFalse(evaluateXPathToBoolean('self::p and true()', new slimdom.Document()));
	});
github FontoXML / fontoxpath / test / specs / parsing / operators / boolean / AndOperator.tests.js View on Github external
it('can optimize an and expression with buckets', () => {
		chai.assert.isFalse(evaluateXPathToBoolean('self::p and true()', new slimdom.Document()));
	});

slimdom

Fast, tiny, standards-compliant XML DOM implementation for node and the browser

MIT
Latest version published 9 months ago

Package Health Score

59 / 100
Full package analysis

Popular slimdom functions