-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Reimplement Messages bubbles using SVG instead of PNG #7
Comments
Hi there,
But at the moment it has no "tail". With your technic we can't do that. So what i see now:
Your cons:
My pros:
My cons:
So we need somehow to get the best from our solutions. I was thinking about using -webkit-mask with SVG masks, but i am not sure that it is possible What do you think:) |
About flex box. I think you mean fallback syntax for older browsers. Yes, please help!:) These flex-box differences drive me crazy) |
I updated the gist using -webkit-mask-box-image. That was a very good idea, it makes a lot of things possible. Here's the updated demo I'll adjust the radius of the corners next. Easy to do. |
@ptb that is fantastic!) Exactly what we need, the only thing need to be fixed is a border radius. I mean when have for example one character in bubble, bubble should look like a circle |
Hmm, just checked, you are right, for some reason i was sure that they are round as circles:) Ok, so now they are perfect. Will you make a PR or you want me to merge it manually? |
I'll make a PR. :-) |
Ok, by the way, could we unescape svg's url or it is required? I checked and seems to work fine, and it saves almost half size:) |
I percent encoded it based on David Bushell's recommendation, but according to him, it "only works on Safari and Chrome". Since -webkit-mask-box-image will only work on Webkit-based browsers anyway, it seems like it won't be an issue. I tested it as a background-image on Firefox 28 and it didn't have a problem either. I don't have a copy of IE readily available to test. I changed the data URI of one of the images to see if I could make it break. I tried uploading the page to a web server configured to serve the file as ISO-2022-JP, and it still displayed correctly. (Granted all of the characters in the content are in the ASCII character set, so it shouldn't be an issue anyway.) Even though it is not to spec (RFC 2397 and RFC 3986), I think you're right and it should just be used unescaped. Also, dbushell.com says that base64 encoding is always smaller, but he's wrong. When sending the page over the wire, it (should be) sent as gzip. Since the content is text, gzip is able to compress it much more than if it was base64 encoded. |
And I tried validating it without percent encoding on http://validator.w3.org and http://jigsaw.w3.org/css-validator/ and neither of them had a problem with it. |
I agree, let's keep it unescaped and without base64 |
Anyway, each bubble size is around just 200 bytes. Base64 will not help us a lot here, so let's keep it plain |
I updated the gist. |
Looks great, right? I think you can pull it |
Are you opposed (or know more than I do why it might be a bad idea) to simplify the CSS class naming for messages? I made the proposed changes here. Basically, shorten the class names and use the semantic HTML elements instead of |
It is simple. We can't use <p> tag for a few reasons:
And the worst thing here is that many still use such things:
And such thing could broke many things. And i guess no one will do such commong css rules for just <div> tags
|
The same could happen with short classnames as "sent" or "received", and i sure that someone could use "pic" class in their custom layouts. So using such scoped classes is also more safe here |
I didn't even think of |
I think we can close this issue for now |
I reimplemented the messages component using SVG and inlined the SVG code in CSS. If you're interested in moving in this direction, I could put together a pull request, if not, I won't bother.
Here's a gist and a preview.
I have Settings > General > Accessibility > Bold Text turned on on my iOS devices, so the boldness might not match the typical. I could fix that.
Also, some of the flexbox code isn't correct. I've documented every option of shipping browser's implementation of flexbox (including links to the sources) here: http://ptb2.me/flexbox/ I could help with that, too.
The text was updated successfully, but these errors were encountered: