Loading ...
Sorry, an error occurred while loading the content.

2581Re: [jslint] Re: Suggestion for whitespace exception when building an HTML string

Expand Messages
  • Satyam
    Aug 23, 2011
      You can also place the spaces doing the indentation within the string:

      ....'....<whatever>' +

      instead of:
      ........'<whatever>' +

      So much concatenating IS expensive, specially if within a function and
      done over and over again, instead of resolved once as if a constant, and
      used anywhere.

      You can also store HTML as HTML is a script tag with whatever type a
      browser would not recognize:

      <script type="text/x-template" id="whatever-template">

      or, more compliant, you can store it within a div set with display:none,
      however, the HTML stored there must be valid while within a script it
      can be incomplete or contain placeholders for a template processor or
      whatever since, after all, it won't be parsed neither as HTML nor as
      anything else. If you know your segments to be valid, then this is
      quite an advantage

      El 23/08/2011 23:03, paulcrowder1979 escribió:
      > I wasn't aware of the block-level option, so thanks for pointing that
      > out. I'll just move the code that builds the HTML into its own
      > function and specify the option in that function as a workaround for
      > the time being.
      > ------------------------------------------------------------------------
      > No virus found in this message.
      > Checked by AVG - www.avg.com <http://www.avg.com>
      > Version: 10.0.1392 / Virus Database: 1520/3852 - Release Date: 08/23/11

      [Non-text portions of this message have been removed]
    • Show all 7 messages in this topic