mirror of https://github.com/sveltejs/svelte
chore: use create_element everywhere (#17683)
follow-up to #17418. This replaces every occurrence of `document.createElement` with a helper, `create_element`, that delegates to `document.createElementNS`. This makes the code a tiny bit simpler and in theory should allow Svelte to run on `text/xml` documents, though I'm not ready to add a test suite to prevent regressions for something so niche. If we choose to merge this, I think we can safely close #17418 as all the other points (around case sensitivity etc) have already been taken care of AFAICT. ### Before submitting the PR, please make sure you do the following - [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs - [x] Prefix your PR title with `feat:`, `fix:`, `chore:`, or `docs:`. - [x] This message body should clearly illustrate what problems it solves. - [ ] Ideally, include a test that fails without this PR but passes with it. - [ ] If this PR changes code within `packages/svelte/src`, add a changeset (`npx changeset`). ### Tests and linting - [x] Run the tests with `pnpm test` and lint the project with `pnpm lint` --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> Co-authored-by: Tee Ming <chewteeming01@gmail.com>pull/17690/head
parent
bcd170ceb0
commit
9400689e1c
@ -1,6 +1,8 @@
|
||||
import { create_element } from './operations.js';
|
||||
|
||||
/** @param {string} html */
|
||||
export function create_fragment_from_html(html) {
|
||||
var elem = document.createElement('template');
|
||||
var elem = create_element('template');
|
||||
elem.innerHTML = html.replaceAll('<!>', '<!---->'); // XHTML compliance
|
||||
return elem.content;
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue