B
B
Bogdan2017-07-04 13:19:05
Ruby on Rails
Bogdan, 2017-07-04 13:19:05

Slim and true in element attributes?

Hello. Slim for some reason does not store the true value in the element attributes. When false , then everything is fine and "false" is written to the value, and when true , then the empty value is "" .
Here is an example of the h1 element. Tell me please.
SLIM:

doctype html
html
  head
    title Testing
    meta name="keywords" content="template language"
  body
    h1 *{ data: { enabled: true, disabled: false  } } Test

Result:
HTML:
<!DOCTYPE html>
<html>
  <head>
    <title>Testing</title>
    <meta content="template language" name="keywords" />
  </head>
  <body>
    <h1 data-disabled="false" data-enabled="">
      Test
    </h1> 
</body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Demidenko, 2017-07-04
@bogdan_uman

This is how it will work as you need

h1 *{ data: { enabled: true.to_s, disabled: false  } } Test
I think this is all because of the html standard for working with boolean

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question