I''m trying to create some JS that will auto-create some <span> tags (I''ve tried it with <font>, <strong> and a host of others with the same problem) inside of a <div>. The div''s width is set, but the <span>s stay on 1 line and spill over without respecting the parent''s width. If I just have the same structure as normal HTML then it works fine. This happens in IE and FF. http://plusthree.com/~mpeters/span_test/test1.html vs http://plusthree.com/~mpeters/span_test/test2.html Any ideas? -- Michael Peters Developer Plus Three, LP --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael Peters wrote:> http://plusthree.com/~mpeters/span_test/test1.html > vs > http://plusthree.com/~mpeters/span_test/test2.html^ You DON''T have _the_same_ DOM structure in those two files. The first one has SPANs containing words whereas test2''s SPANs contain words padded with whitespace. e.g.: ''lorem'' vs '' lorem '' - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFF2JzatZHp/AYZiNkRAm/IAKD/etqJ2/U/oXyA11OBHnwfsfEJcwCgouCv hUWnQu0txqKNpMvWipJ9PGQ=fZUz -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Marius Feraru wrote:> Michael Peters wrote: >>> http://plusthree.com/~mpeters/span_test/test1.html >>> vs >>> http://plusthree.com/~mpeters/span_test/test2.html > ^ You DON''T have _the_same_ DOM structure in those two files. > The first one has SPANs containing words whereas test2''s SPANs contain words > padded with whitespace. > > e.g.: ''lorem'' vs '' lorem ''Thanks for pointing that. So adding a '' '' to the beginning of the span fixes it. Just out of curiosity, is this how it''s supposed to work? Why wouldn''t the browser break the text between <span> tags? -- Michael Peters Developer Plus Three, LP --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 19, 10:03 am, Michael Peters <mpet...-aUYv5hkjw45l57MIdRCFDg@public.gmane.org> wrote:> Marius Feraru wrote:[...]> > ^ You DON''T have _the_same_ DOM structure in those two files. > > The first one has SPANs containing words whereas test2''s SPANs contain words > > padded with whitespace. > > > e.g.: ''lorem'' vs '' lorem '' > > Thanks for pointing that. So adding a '' '' to the beginning of the span fixes it. > Just out of curiosity, is this how it''s supposed to work? Why wouldn''t the > browser break the text between <span> tags?Because HTML markup itself doesn''t have any effect on presentation. Browsers will (normally) only wrap based on whitespace, span elements aren''t whitespace. Further, span elements are inline elements that have no specific presentation idiom, they are designed to have no effect at all on presentation. Any effect you want them to have you must add yourself as attributes of the element or elements within it. You will probably get a much better answer from an HTML group, try: news:comp.infosystems.www.authoring.html <URL: http://groups.google.com/group/comp.infosystems.www.authoring.html/topics>-- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Well the hard coded HTML example isn''t exactly the same as your JS code, the hard coded equivalent is more like: <div id="test"><span>lorem</span><span>ipsum</span><span>dolor</ span><span>sit</span><span>amet</span><span>consectetuer</ span><span>adipiscing</span><span>elit</span><span>sed</span></div> (one line, no breaks) And in that case, it''s rendering fine because it thinks your <span>s are just one word (CSS word-wrap defaults to not break words to conform to parent width, fyi). So your JS will need to insert breaks of some kind, inserting spaces at the end of each span node for instance: <script type="text/javascript"> var target = $(''test''); target.appendChild(Builder.node(''span'', ''lorem '')); target.appendChild(Builder.node(''span'', ''ipsum '')); target.appendChild(Builder.node(''span'', ''dolor '')); target.appendChild(Builder.node(''span'', ''sit '')); target.appendChild(Builder.node(''span'', ''amet '')); target.appendChild(Builder.node(''span'', ''consectetuer '')); target.appendChild(Builder.node(''span'', ''adipiscing '')); target.appendChild(Builder.node(''span'', ''elit '')); target.appendChild(Builder.node(''span'', ''sed '')); </script> On Feb 18, 8:11 am, Michael Peters <mpet...-aUYv5hkjw45l57MIdRCFDg@public.gmane.org> wrote:> I''m trying to create some JS that will auto-create some <span> tags (I''ve tried > it with <font>, <strong> and a host of others with the same problem) inside of a > <div>. The div''s width is set, but the <span>s stay on 1 line and spill over > without respecting the parent''s width. If I just have the same structure as > normal HTML then it works fine. This happens in IE and FF. > > http://plusthree.com/~mpeters/span_test/test1.html > vshttp://plusthree.com/~mpeters/span_test/test2.html > > Any ideas? > -- > Michael Peters > Developer > Plus Three, LP--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---