Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 510352e

Browse files
committed
Moved backgroundColor to new style property
1 parent 6310565 commit 510352e

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ If `gravity` is equals to `bottom`, it will be pushed from bottom.
140140
| close | boolean | To show the close icon or not | false |
141141
| gravity | "top" or "bottom" | To show the toast from top or bottom | "top" |
142142
| position | "left" or "right" | To show the toast on left or right | "right" |
143-
| backgroundColor | CSS background value | Sets the background color of the toast. To be deprecated, use `style.backgroundColor` option instead | |
143+
| backgroundColor | CSS background value | To be deprecated, use `style.background` option instead. Sets the background color of the toast | |
144144
| avatar | URL string | Image/icon to be shown before text | |
145145
| className | string | Ability to provide custom class name for further customization | |
146146
| stopOnFocus | boolean | To stop timer when hovered over the toast (Only if duration is set) | true |

‎src/toastify-es.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ class Toastify {
196196

197197
if (this.options.backgroundColor) {
198198
// This is being deprecated in favor of using the style HTML DOM property
199-
console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.backgroundColor" property.');
200-
divElement.style.background = this.options.backgroundColor;
199+
// We'll go ahead and just add the `backgroundColor` to the `style` object to simulate correct settings moving forward
200+
console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
201+
this.options.style.background = this.options.backgroundColor;
201202
}
202203

203204
// Loop through our style object and apply styles to divElement

‎src/toastify.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@
9494
divElement.className += " " + this.options.gravity;
9595

9696
if (this.options.backgroundColor) {
97-
//This is being deprecated in favor of using the style HTML DOM property
98-
console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.backgroundColor" property.');
99-
divElement.style.background = this.options.backgroundColor;
97+
// This is being deprecated in favor of using the style HTML DOM property
98+
// We'll go ahead and just add the `backgroundColor` to the `style` object to simulate correct settings moving forward
99+
console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
100+
this.options.style.background = this.options.backgroundColor;
100101
}
101102

102103
// Loop through our style object and apply styles to divElement

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /