jquery-timeago
jquery-timeago copied to clipboard
Small change: using jquerys .html() instead of .text() to enable usage of html entities
[mod] improving typography: enabling usage of non-breaking-space character ( ) in textfields, this is important to prevent a line break between the number and the timeframe
Thanks for taking the time to submit this, but I'm sorry, I'm not going to pull this in. Reasons:
- Not everyone will want the same non-breaking space behavior.
- All language packs would also have to be updated (not a clean design).
-
entities are kinda ugly.
It would be better to use CSS to manage whether you want the timestamps to wrap or not. For example, you can prevent word wrapping with something like this:
abbr.timeago { white-space: nowrap; }
or if you are willing to use a deprecated HTML tag, you can wrap the timestamp between <nobr></nobr>
.
Ok, thx for taking the time to check the pull request and answering. Let me explain it more detailed: using the in the text settings would be optional, but if someone want to use it, .text() can't handle this, using .html() is necessary.
- Not everyone will want the same non-breaking space behavior.
Right, maybe. Even this is a typographical no-go :) Number and unit (timeframe) should not be splitted up on two lines.
- All language packs would also have to be updated (not a clean design).
No, that's not mandatory. Using the non-breaking-space char is only a option.
- entities are kinda ugly.
Maybe, but's the HTML entity for the non-breaking-space character what is a typographical sign on its own.
It would be better to use CSS to manage whether you want the timestamps to wrap or not.
That would be possible but it's not the same. If you are using nowrap
CSS, e.g. for "25 minutes ago" then the whole phrase cannot be splitted to two lines, what could lead to overflowed boxes or the whole line breaks before the 25. Same with the <nobr>
usage. Using a non-breaking-space character "25 minutes" is kept together but "ago" can be on the next line. A slight but typographically important difference :)
regards, Haschek
Haschek, Okay, you've made a strong enough argument for me to reopen this. Let me give it some thought to make sure there wasn't a good reason for me using text()
instead of html()
.
Maybe this helps?
http://stackoverflow.com/questions/1910794/jquery-text-vs-html/
Or this?
http://jsperf.com/jquery-text-vs-html/2
@rmm5t Any updates on this PR?