| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|---|
| 3 | <head> |
|---|
| 4 | <title></title> |
|---|
| 5 | <style> |
|---|
| 6 | * { |
|---|
| 7 | line-height: 20px; |
|---|
| 8 | } |
|---|
| 9 | </style> |
|---|
| 10 | <script src="http://www.google.com/jsapi"></script> |
|---|
| 11 | <script> |
|---|
| 12 | // Load jQuery |
|---|
| 13 | google.load("jquery", "1.3.2"); |
|---|
| 14 | // <br> is not really "visible" when appear |
|---|
| 15 | // at the end of block where there's no more consequent text after it. |
|---|
| 16 | google.setOnLoadCallback(function() { |
|---|
| 17 | |
|---|
| 18 | $(document.body).children().each( function( index, para ){ |
|---|
| 19 | $( para ).children( '.content' ).append( document.createTextNode( ' contentHeight: ' + para.offsetHeight ) ); |
|---|
| 20 | } ); |
|---|
| 21 | }); |
|---|
| 22 | </script> |
|---|
| 23 | </head> |
|---|
| 24 | <body> |
|---|
| 25 | <p><span class="content">This paragraph has no br.</span></p> |
|---|
| 26 | <p><span class="content">This paragraph has one br at end.</span><br /></p> |
|---|
| 27 | <p><span class="content">This paragraph has one br at end.</span><br /> |
|---|
| 28 | </p> |
|---|
| 29 | <div><span class="content">This div has one br at end.</span><br /></div> |
|---|
| 30 | <p><br /><span class="content">This paragraph has one br at start.</span></p> |
|---|
| 31 | <p><span class="content">This paragraph has two br at end.</span><br /><br /></p> |
|---|
| 32 | </body> |
|---|
| 33 | </html> |
|---|