Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using both the class dot notation and attribute map prevents evaluation of local variables #143

Open
benzap opened this issue Apr 14, 2017 · 1 comment

Comments

@benzap
Copy link

benzap commented Apr 14, 2017

The code

(let [class-local-var "class-foo class-bar"]
  (hiccup.page/html5 
   [:body
    [:div.test {:class class-local-var}]]))

Expected output

<!DOCTYPE html>
<html><body><div class="test class-foo class-bar"></div></body></html>

Actual output

<!DOCTYPE html>
<html><body><div class="test class-local-var"></div></body></html>

Note that the symbol class-local-var was not evaluated into class-foo class-bar

Tested on Version 1.0.5

@benzap
Copy link
Author

benzap commented Apr 14, 2017

This only appears to happen when you include a class with dot notation and through the map attributes :class keyword. The workaround currently would be to only use dot notation or only using map attributes until this is fixed.

pieter-van-prooijen pushed a commit to pieter-van-prooijen/hiccup that referenced this issue Apr 15, 2018
…ributes

Allow for the combination of classes in the tag keyword and non-literal
class attributes by evaluating the latter at runtime.
pieter-van-prooijen pushed a commit to pieter-van-prooijen/hiccup that referenced this issue Apr 17, 2018
Generate the correct class attribute of an element when the class names
are both present as:

- part of the element keyword (using the dot notation)
- a non-literal value of the :class key in the attribute map
  (specifically when using a symbol as the value).

Fixes issue weavejester#143
pieter-van-prooijen pushed a commit to pieter-van-prooijen/hiccup that referenced this issue Apr 22, 2018
Generate the correct class attribute of an element when the class names
are both present as:

- part of the element keyword (using the dot notation)
- a non-literal value of the :class key in the attribute map
  (specifically when using a symbol as the value).

Fixes issue weavejester#143
pieter-van-prooijen pushed a commit to pieter-van-prooijen/hiccup that referenced this issue Apr 23, 2018
Generate the correct class attribute of an element when the class names
are both present as:

- part of the element keyword (using the dot notation)
- a non-literal value of the :class key in the attribute map
  (specifically when using a symbol as the value).

Fixes issue weavejester#143
pieter-van-prooijen pushed a commit to pieter-van-prooijen/hiccup that referenced this issue Apr 30, 2018
Generate the correct class attribute of an element when the class names
are both present as:

- part of the element keyword (using the dot notation)
- a non-literal value of the :class key in the attribute map
  (specifically when using a symbol as the value).

Fixes issue weavejester#143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant