From c87c6018bfe2a039408efeb009a9f1480afcf36f Mon Sep 17 00:00:00 2001 From: Pauan Date: Sat, 18 Sep 2021 21:04:54 +0200 Subject: [PATCH] Changing style so that it only panics in debug mode --- src/dom.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dom.rs b/src/dom.rs index edd43a5..6e6d9f1 100644 --- a/src/dom.rs +++ b/src/dom.rs @@ -316,7 +316,6 @@ fn set_style(style: &CssStyleDeclaration, name: &A, value: B, important: b bindings::set_style(style, name, value, important); - // TODO maybe use cfg(debug_assertions) ? let is_changed = bindings::get_style(style, name) != ""; if is_changed { @@ -339,8 +338,10 @@ fn set_style(style: &CssStyleDeclaration, name: &A, value: B, important: b }); if let None = okay { - // TODO maybe make this configurable - panic!("style is incorrect:\n names: {}\n values: {}", names.join(", "), values.join(", ")); + if cfg!(debug_assertions) { + // TODO maybe make this configurable + panic!("style is incorrect:\n names: {}\n values: {}", names.join(", "), values.join(", ")); + } } }