Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxodin committed Jun 10, 2022
1 parent 3066733 commit 0a155c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ class Dialog {

function toOptions(text) {
if (typeof text === 'string') {
return obj = {
return {
body: htmlEntities(text)
};
}
return text;
}

export function alert(text) {
const options = toOptions(text)
const options = toOptions(text);
const dialog = new Dialog({
body:options.body,
buttons:[{title:'OK'}]
Expand Down
8 changes: 4 additions & 4 deletions tests/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

<style>
:where(.\:modal, :modal) {
width:18rem;
box-shadow:0 0 1rem #0008;
border:none;
border-radius:.3rem;
width: 18rem;
box-shadow: 0 0 1rem #0008;
border: 0;
border-radius: .3rem;
}
</style>

Expand Down
9 changes: 5 additions & 4 deletions tests/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ <h2>alert, confirm, prompt</h2>
<h2>Tests</h2>

<button onclick="dialog.alert('Html content: <b>bold</b>')">Html content not parsed </button>
<button onclick="dialog.alert({body:'Html content: <b>bold</b>'})">Html parsed </button>

<br>
<br>
Expand Down Expand Up @@ -117,9 +118,9 @@ <h2>Tests</h2>
<style contenteditable>
/* .u1x-modal { */
:where(.\:modal, :modal) {
width:18rem;
box-shadow:0 0 1rem #0008;
border:none;
border-radius:.3rem;
width: 18rem;
box-shadow: 0 0 1rem #0008;
border: 0;
border-radius: .3rem;
}
</style>

0 comments on commit 0a155c8

Please sign in to comment.