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

Add support for render() outside of each() data-query #83

Open
astoilkov opened this issue Aug 16, 2015 · 4 comments
Open

Add support for render() outside of each() data-query #83

astoilkov opened this issue Aug 16, 2015 · 4 comments

Comments

@astoilkov
Copy link
Owner

As per suggestion: #58

@henrikekblad
Copy link

+1

@Kanaye
Copy link
Collaborator

Kanaye commented Oct 25, 2015

I read the suggestion and I see a problem as far as I understeand the issue.
If you have an expression in an images source like so:

<img src="{{myImage}}" />

the problem (at least for me) is that the browser would have the error that {{myImage}} is not a correct url. An other case might be a mobile device where you don't want some images to load to smaller your apps/pages traffic.
something like that:

<img src="big-image.jpg" data-query="render(!isMobile)" />

The problem is, that the browser would have parsed the attributes and started the request before the dom is ready.
So we have no chance to remove that image before the browser starts the request.

Tell me if there are other cases an element should be removed instead of hidden.

I saw the attr()-data-query is currently not capable to set the src attribute.
Maybe we should implement that, cause the attr data-query combined with the visible data-query would be my suggstion for the described case.

@astoilkov
Copy link
Owner Author

Yes. I thought the attr data-query works correctly. Otherwise it really doesn't make sense.

@Kanaye
Copy link
Collaborator

Kanaye commented Oct 25, 2015

short update:
The attr data-query works as expected with the src attribute.
For some reason it fails on one of my computers in chrome, but seems to be an issue with the installation and not with jsblocks.
[edit:]
Works perfectly on the computer it failed before after reinstalling chrome...
[/edit]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants