lantiga / react.hiccup

React 0% JSX, 100% hiccup
MIT License
81 stars 0 forks source link

Is it possible to use pass a string for the css selector? #5

Closed hth2 closed 10 years ago

hth2 commented 10 years ago

sometime I would like to be able to write this: var elem = "div." + myClassName; return hiccup[elem "abc"];

ie the value of the class (or id) is known at runtime only. Can you please support this?

lantiga commented 10 years ago

I'm afraid this is beyond the purpose of css selectors (and it would probably require a complete rewrite). In this case I think you should resort to

return hiccup [div {className myClassName} "abc"]

If this gets annoying because you need to do this in several places in your code, it would probably be a good idea to create a component.

On Tue, Feb 11, 2014 at 12:20 PM, hanthethanh notifications@github.comwrote:

sometime I would like to be able to write this: var elem = "div." + myClassName; return hiccup[elem "abc"];

ie the value of the class (or id) is known at runtime only. Can you please support this?

Reply to this email directly or view it on GitHubhttps://github.com/lantiga/react.hiccup/issues/5 .

Luca Antiga, PhD Co-founder and Principal Scientist, OROBIX Srl via L.A. Muratori 3, 24123 Bergamo, Italy

web: lantiga.github.io github: https://github.com/lantiga twitter: @lantiga mobile: +39.347.43.16.596

"This message originates from OROBIX Srl and its contents and attachments are privileged and confidential and are intended only for the individual(s) or entity(ies) named above. This message should not be forwarded, distributed or disclosed. Any unauthorized use, dissemination and duplication is strictly prohibited and may be unlawful. All personal messages express views solely of the sender, which are not to be attributed to OROBIX Srl, and may not be copied or distributed without this disclaimer. If you are not the intended recipient or received this message in error, please delete this message and notify the sender by reply e-mail. Opinions, conclusions and other information in this message that do not relate to the official business of OROBIX Srl shall be understood as neither given nor endorsed by it."

hth2 commented 10 years ago

thank you the thorough reply. Can you please close the issue?

On 11 February 2014 12:28, Luca Antiga notifications@github.com wrote:

I'm afraid this is beyond the purpose of css selectors (and it would probably require a complete rewrite). In this case I think you should resort to

return hiccup [div {className myClassName} "abc"]

If this gets annoying because you need to do this in several places in your code, it would probably be a good idea to create a component.

On Tue, Feb 11, 2014 at 12:20 PM, hanthethanh <notifications@github.com

wrote:

sometime I would like to be able to write this: var elem = "div." + myClassName; return hiccup[elem "abc"];

ie the value of the class (or id) is known at runtime only. Can you please support this?

Reply to this email directly or view it on GitHub< https://github.com/lantiga/react.hiccup/issues/5> .

Luca Antiga, PhD Co-founder and Principal Scientist, OROBIX Srl via L.A. Muratori 3, 24123 Bergamo, Italy

web: lantiga.github.io github: https://github.com/lantiga twitter: @lantiga mobile: +39.347.43.16.596

"This message originates from OROBIX Srl and its contents and attachments are privileged and confidential and are intended only for the individual(s) or entity(ies) named above. This message should not be forwarded, distributed or disclosed. Any unauthorized use, dissemination and duplication is strictly prohibited and may be unlawful. All personal messages express views solely of the sender, which are not to be attributed to OROBIX Srl, and may not be copied or distributed without this disclaimer. If you are not the intended recipient or received this message in error, please delete this message and notify the sender by reply e-mail. Opinions, conclusions and other information in this message that do not relate to the official business of OROBIX Srl shall be understood as neither given nor endorsed by it."

Reply to this email directly or view it on GitHubhttps://github.com/lantiga/react.hiccup/issues/5#issuecomment-34745926 .