Skip to content

Commit

Permalink
Fix stringifying elements
Browse files Browse the repository at this point in the history
  • Loading branch information
shgysk8zer0 committed Nov 14, 2024
1 parent 85e0137 commit 521c3d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.2.18] - 2024-11-14

### Fixed
- Fixed stringifying elements

## [v0.2.17] - 2024-11-09

### Added
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aegisjsproject/core",
"version": "0.2.17",
"version": "0.2.18",
"description": "A fast, secure, modern, light-weight, and simple JS library for creating web components and more!",
"keywords": [
"aegis",
Expand Down
4 changes: 1 addition & 3 deletions stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const formatNumber = 'Intl' in globalThis && Intl.NumberFormat instanceof Functi
? num => new Intl.NumberFormat().format(num)
: num => num.toString();

const formatEl = Element.prototype.getHTML instanceof Function ? el => el.getHTML() : el => el.outerHTML;

export const stringify = thing => {
switch(typeof thing) {
case 'string':
Expand Down Expand Up @@ -108,7 +106,7 @@ export const stringify = thing => {
el.append(thing.content.cloneNode(true));
return el.innerHTML;
} else if (thing instanceof Element) {
return formatEl(thing);
return thing.outerHTML;
} else if (thing instanceof DocumentFragment) {
const el = document.createElement('div');
el.append(thing.cloneNode(true));
Expand Down

0 comments on commit 521c3d3

Please sign in to comment.