pull/17683/head
Simon H 1 day ago committed by GitHub
parent f40baaa26a
commit cc5185e03b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,7 +19,7 @@ export function append_styles(anchor, css) {
// Always querying the DOM is roughly the same perf as additionally checking for presence in a map first assuming
// that you'll get cache hits half of the time, so we just always query the dom for simplicity and code savings.
if (!target.querySelector('#' + css.hash)) {
const style = /** @type {HTMLStyleElement} */ (create_element('style'));
const style = create_element('style');
style.id = css.hash;
style.textContent = css.code;

@ -105,7 +105,7 @@ if (typeof HTMLElement === 'function') {
*/
return (anchor) => {
const slot = create_element('slot');
if (name !== 'default') /** @type {HTMLSlotElement} */ (slot).name = name;
if (name !== 'default') slot.name = name;
append(anchor, slot);
};

@ -231,16 +231,6 @@ export function should_defer_append() {
return (flags & EFFECT_RAN) !== 0;
}
/**
*
* @param {string} tag
* @param {string} [namespace]
* @param {string} [is]
* @returns
*/
export function create_element(tag, namespace, is) {
let options = is ? { is } : undefined;
return document.createElementNS(namespace ?? NAMESPACE_HTML, tag, options);
/**
* @template {keyof HTMLElementTagNameMap | string} T
* @param {T} tag

@ -4,5 +4,5 @@ import { create_element } from './operations.js';
export function create_fragment_from_html(html) {
var elem = create_element('template');
elem.innerHTML = html.replaceAll('<!>', '<!---->'); // XHTML compliance
return /** @type {HTMLTemplateElement} */ (elem).content;
return elem.content;
}

Loading…
Cancel
Save