Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicode alternative for <wbr> tag

Tags:

unicode

wbr

I am looking for Unicode solution which will be an alternative to <wbr> tag in following regards:

  1. Allowing line breaks at given position.
  2. Browser can find string in the page even when 'broken' apart.
  3. When copied from page, these characters will not be transfered.

This is exactly what <wbr> does in modern browsers. &shy;, &#x00ad; and &#x200b; does not seem to conform.

Here is a http://jsfiddle.net/qY6mp/7/ to demonstrate.

I will be thankful for any pointers.

like image 498
Oliver Gondža Avatar asked Apr 26 '13 20:04

Oliver Gondža


People also ask

What is WBR tag in HTML?

The <wbr> (Word Break Opportunity) tag specifies where in a text it would be ok to add a line-break. Tip: When a word is too long, the browser might break it at the wrong place. You can use the <wbr> element to add word break opportunities.

How do you write WBR?

<wbr>: The Line Break Opportunity element The <wbr> HTML element represents a word break opportunity—a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location.


1 Answers

The Unicode counterpart of <wbr> is U+200B ZERO WIDTH SPACE, representable in HTML as &#x200b; if you don’t want or can’t use it as such. It’s not clear from the question why you think it does not conform. The main problem with it as questionable support in IE 6, but this is not a conformance issue.

According to Unicode line breaking rules, U+200B “is used to enable additional (invisible) break opportunities wherever SPACE cannot be used”. HTML specifications do not require conformance to the Unicode standard, in this issue or otherwise, but modern browsers generally implement U+200B this way.

What happens when text is copied from an HTML document is outside the scope of specifications. The same applies to requirement 2 in the question. Since generally copy and paste copies characters, including zero width characters, and search functionality operates on characters, requirements 2 and 3 are really asking for a character that does not behave like character.

Note that hyphenation is completely different issue.

like image 99
Jukka K. Korpela Avatar answered Oct 14 '22 04:10

Jukka K. Korpela