How to use the @aurelia/runtime-html.DOM function in @aurelia/runtime-html

To help you get started, we’ve selected a few @aurelia/runtime-html 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 aurelia / aurelia / packages / testing / dist / umd / h.js View on Github external
//   let cmd = attr.slice(lastIdx + 1);
                        //   cmd = cmd ? kebabCase(cmd) : 'bind';
                        //   el.setAttribute(`${kebabCase(attr.slice(0, lastIdx))}.${cmd}`, value);
                        // }
                    }
                }
            }
        }
        const appender = el.content != null ? el.content : el;
        for (const child of children) {
            if (child == null) {
                continue;
            }
            if (Array.isArray(child)) {
                for (const child_child of child) {
                    appender.appendChild(runtime_html_1.DOM.isNodeInstance(child_child) ? child_child : runtime_html_1.DOM.createTextNode(`${child_child}`));
                }
            }
            else {
                appender.appendChild(runtime_html_1.DOM.isNodeInstance(child) ? child : runtime_html_1.DOM.createTextNode(`${child}`));
            }
        }
        return el;
    };
});
github aurelia / aurelia / packages / testing / dist / umd / inspect.js View on Github external
braces[0] = `${getPrefix(constructor, tag, 'Object')}{`;
                }
            }
        }
        if (recurseTimes > ctx.depth && ctx.depth !== null) {
            return ctx.stylize(`[${getCtxStyle(constructor, tag)}]`, 'special');
        }
        recurseTimes += 1;
        ctx.seen.push(value);
        ctx.currentDepth = recurseTimes;
        let output;
        const indentationLvl = ctx.indentationLvl;
        try {
            output = formatter(ctx, value, recurseTimes, keys, braces);
            let $key;
            const isNotNode = !(value instanceof runtime_html_1.DOM.Node);
            for (i = 0; i < keys.length; i++) {
                $key = keys[i];
                if (
                // Aurelia-specific:
                // Don't deep inspect html nodes, they are huge, have many irrelevant properties and make the diff unreadable
                (isNotNode || $key === 'textContent' || $key === 'outerHTML')
                    // Aurelia-specific:
                    // By convention we use $$calls for the CallCollection tracker, never deep inspect that as it's never relevant to the assertion
                    && $key !== '$$calls') {
                    output.push(formatProperty(ctx, value, recurseTimes, keys[i], extrasType));
                }
            }
        }
        catch (err) {
            return handleMaxCallStackSize(ctx, err, constructor, tag, indentationLvl);
        }
github aurelia / aurelia / packages / aurelia / dist / umd / index.js View on Github external
exports.createElement = runtime_html_1.createElement;
    // RenderPlan,
    // HTMLAttributeInstruction,
    // HTMLInstructionRow,
    // HTMLNodeInstruction,
    // HTMLTargetedInstruction,
    // HTMLTargetedInstructionType,
    // IAttributeBindingInstruction,
    // IListenerBindingInstruction,
    // ISetAttributeInstruction,
    // isHTMLTargetedInstruction,
    // IStylePropertyBindingInstruction,
    // ITextBindingInstruction,
    // NodeType,
    exports.HTMLDOM = runtime_html_1.HTMLDOM;
    exports.DOM = runtime_html_1.DOM;
    // NodeSequenceFactory,
    // FragmentNodeSequence,
    // AttributeBindingInstruction,
    // CaptureBindingInstruction,
    // DelegateBindingInstruction,
    // SetAttributeInstruction,
    // SetClassAttributeInstruction,
    // SetStyleAttributeInstruction,
    // StylePropertyBindingInstruction,
    // TextBindingInstruction,
    // TriggerBindingInstruction,
    // ContainerlessProjector,
    // HostProjector,
    // HTMLProjectorLocator,
    // ShadowDOMProjector,
    exports.StyleConfiguration = runtime_html_1.StyleConfiguration;
github aurelia / aurelia / packages / testing / dist / umd / h.js View on Github external
function h(name, attrs = null, ...children) {
        const el = runtime_html_1.DOM.createElement(name);
        for (const attr in attrs) {
            if (attr === 'class' || attr === 'className' || attr === 'cls') {
                let value = attrs[attr];
                value = value === undefined || value === null
                    ? emptyArray
                    : Array.isArray(value)
                        ? value
                        : (`${value}`).split(' ');
                el.classList.add(...value.filter(Boolean));
            }
            else if (attr in el || attr === 'data' || attr.startsWith('_')) {
                el[attr.replace(/^_/, '')] = attrs[attr];
            }
            else {
                el.setAttribute(attr, attrs[attr]);
            }
github aurelia / aurelia / packages / testing / dist / umd / assert.js View on Github external
    function getNode(elementOrSelector, root = runtime_html_1.DOM.document) {
        return typeof elementOrSelector === "string"
            ? root.querySelector(elementOrSelector)
            : elementOrSelector;
    }
    function isTextContentEqual(elementOrSelector, expectedText, message, root) {
github aurelia / aurelia / packages / testing / dist / umd / assert.js View on Github external
function matchStyle(element, expectedStyles) {
        const styles = runtime_html_1.DOM.window.getComputedStyle(element);
        for (const [property, expected] of Object.entries(expectedStyles)) {
            const actual = styles[property];
            if (actual !== expected) {
                return { isMatch: false, property, actual, expected };
            }
        }
        return { isMatch: true };
    }
    function computedStyle(element, expectedStyles, message) {
github aurelia / aurelia / packages / fetch-client / dist / umd / http-client.js View on Github external
trackRequestEnd() {
            this.isRequesting = !!(--this.activeRequestCount);
            if (!this.isRequesting) {
                const evt = runtime_html_1.DOM.createCustomEvent('aurelia-fetch-client-requests-drained', { bubbles: true, cancelable: true });
                runtime_html_1.DOM.window.setTimeout(() => { runtime_html_1.DOM.dispatchEvent(evt); }, 1);
            }
        }
        processRequest(request, interceptors) {
github aurelia / aurelia / packages / fetch-client / dist / umd / retry-interceptor.js View on Github external
                            return new Promise((resolve) => runtime_html_1.DOM.window.setTimeout(resolve, !isNaN(delay) ? delay : 0))
                                .then(() => {
github aurelia / aurelia / packages / fetch-client / dist / umd / http-client.js View on Github external
trackRequestEnd() {
            this.isRequesting = !!(--this.activeRequestCount);
            if (!this.isRequesting) {
                const evt = runtime_html_1.DOM.createCustomEvent('aurelia-fetch-client-requests-drained', { bubbles: true, cancelable: true });
                runtime_html_1.DOM.window.setTimeout(() => { runtime_html_1.DOM.dispatchEvent(evt); }, 1);
            }
        }
        processRequest(request, interceptors) {