Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How do I create non-breaking space (  ) with HTML::Element?

by Tanalis (Curate)
on Aug 08, 2005 at 13:29 UTC ( #481870=note: print w/ replies, xml ) Need Help??


in reply to How do I create non-breaking space (  ) with HTML::Element?

I'd take a look at the ~literal pseudo-element in the docs .. that looks like it should be able to do what you need.

Untested, but ..

my $literal = HTML::Element->new('~literal', 'text' => ' ' ); my $element = HTML::Element->new('td', "class"=>"zwischanspalte"); $element->push_content($literal);
might give you some ideas :)

Hope that helps ...


Comment on Re: How do I create non-breaking space (  ) with HTML::Element?
Select or Download Code
Replies are listed 'Best First'.
Re^2: How do I create non-breaking space (  ) with HTML::Element?
by tphyahoo (Vicar) on Aug 08, 2005 at 13:52 UTC
    Thanks foxcub, that did the trick. I just had to delete whitespace to pass the test :)
    use strict; use warnings; use HTML::Element; use Test::More qw(no_plan); my $literal = HTML::Element->new('~literal', 'text' => '&nbsp;' ); my $element = HTML::Element->new('td', "class"=>"zwischanspalte"); $element->push_content($literal); my $expected = '<td class="zwischanspalte">&nbsp;</td>'; my $html = $element->as_HTML(); $html =~ s/[\r\n]//; is($html, $expected);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://481870]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2015-07-29 22:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls