Jaxer modifies a valid HTML input and making it invalid

Discussion about how to code things with Jaxer.

Moderator: Aptana Staff

Jaxer modifies a valid HTML input and making it invalid

Postby vanilla » Sun May 17, 2009 9:01 pm

Hello,

I have been poking with Jaxer for a while now molding it to my needs, today I validated the output of my pages and I came to the conclusion that Jaxer is making my output invalid, example:

my input header:
Code: Select all
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


Get transformed to:
Code: Select all
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


Without self closing tags.

Same counts for the my doctype:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


get changed to a complete UPPERCASE:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


Is there some hidden setting I'm missing here? Or am i just screwing something up here.
Arnout Kazemier

Adobe Spry Community Expert

3rdEden | 3rd-Eden.com | Spry-it.com | config.Spry-it.com
Twitter: http://www.twitter.com/3rdEden | http://www.twitter.com/AdobeSpry
User avatar
vanilla
 
Posts: 16
Joined: Mon May 11, 2009 6:20 pm

Re: Jaxer modifies a valid HTML input and making it invalid

Postby tangent » Mon May 18, 2009 9:34 am

Known issue. Search this forum for XHTML.
tangent
 
Posts: 201
Joined: Fri Mar 28, 2008 11:59 am

Re: Jaxer modifies a valid HTML input and making it invalid

Postby vanilla » Thu May 21, 2009 3:13 pm

Yes i found some information about that. If i change my html extension to .xhtml it will stop rendering my page on server
because it finds issues with my HTML.

This is because I use custom attributes on the elements. And than later on when the file has been completely parsed they are removed.

for example my template setup for the head region:
Code: Select all
<head id="head" spry:region="dsHead">
       <title>{title}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta http-equiv="Content-Language" content="en" />
      <meta http-equiv="imagetoolbar" content="no" />
      <meta name="copyright" content="{copyright}" />
       <meta name="author" content="{author}" />
       <meta name="email" content="{author_email}" />
       <meta name="Revisit-after" content="1 Day" />
      <meta name="keywords" content="{keywords}" />
      <meta name="description" content="{description}" />
      <meta name="viewport" content="width=320, user-scalable=yes" />
      <script type="text/javascript" runat="client">document.documentElement.className = "js";</script>
      <link type="text/css" rel="stylesheet" href="themes/{template}/css/reset.css?v={cssversion}" />
      <link type="text/css" rel="stylesheet" href="themes/{template}/css/layout.css?v={cssversion}" />
      <link rel="apple-touch-icon" href="themes/{template}/images/apple-touch-icon.png" />
    </head>


It will chock there, I could add the tags "onserverload" using element selectors and setAttribute but that would just be waste of back end rendering and performance. But if there is no other way.. I guess ill just have to go HTML based instead of xhtml. It gives to much extra work serverside for such a stupid rendering issue.
Arnout Kazemier

Adobe Spry Community Expert

3rdEden | 3rd-Eden.com | Spry-it.com | config.Spry-it.com
Twitter: http://www.twitter.com/3rdEden | http://www.twitter.com/AdobeSpry
User avatar
vanilla
 
Posts: 16
Joined: Mon May 11, 2009 6:20 pm

Re: Jaxer modifies a valid HTML input and making it invalid

Postby tangent » Thu May 21, 2009 8:14 pm

I sympathize with your problem, but it's happening because you're fighting the tool. I doubt Aptana will ever "fix" this, because you're working against a fundamental design choice, which is that Jaxer reads in the server-side copy of the page just like a web browser. If you load that same page up into Firefox and do View | Source, you'll see the same changes to your code.

Instead of trying to arm-twist Jaxer into doing what you want, consider using a templating language of some sort in addition to Jaxer. It's better for replacing strings in the HTML before Jaxer gets it. I prefer static templating systems wherever I can get away with it, as opposed to dynamic templating like PHP, ASP, JSP... You get dynamic server-side behavior from Jaxer anyway. I use WPP, GTML, and DocBook on my various sites. WPP and GTML are moribund, but still work for me, so I haven't really looked for newer alternatives. DocBook is rather specialized, but useful when you need a PDF copy of a section of a web site in addition to the HTML version.
tangent
 
Posts: 201
Joined: Fri Mar 28, 2008 11:59 am

Re: Jaxer modifies a valid HTML input and making it invalid

Postby vanilla » Fri May 22, 2009 12:20 pm

First of all thank for your information. I might indeed be fighting the system here. Also thanks for the template language suggestions. But my whole project is based around the Adobe Spry framework, this site will be used use showcase example of what Adobe Spry can do, client side as well server side.

(BTW: If i view source i still see perfect validate-able page)
Arnout Kazemier

Adobe Spry Community Expert

3rdEden | 3rd-Eden.com | Spry-it.com | config.Spry-it.com
Twitter: http://www.twitter.com/3rdEden | http://www.twitter.com/AdobeSpry
User avatar
vanilla
 
Posts: 16
Joined: Mon May 11, 2009 6:20 pm

Re: Jaxer modifies a valid HTML input and making it invalid

Postby tangent » Fri May 22, 2009 3:13 pm

vanilla wrote:my whole project is based around the Adobe Spry framework, this site will be used use showcase example of what Adobe Spry can do, client side as well server side.

I don't see what that has to do with anything. The output of a static templating language is HTML files. Surely those HTML files can then use Spry? Let the templating language take care of drudgery like routine, repeatable text replacement tasks.

If i view source i still see perfect validate-able page)

To be clear: are you testing with Firefox 3.0, or something else? If something else, you're not replicating Jaxer's view of HTML.

If you are indeed testing Firefox 3.0 against Jaxer 1.0, then there is some other difference between the way the two HTML parsing engines are seeing the file. File name extensions, Apache MIME settings, and other things can affect this.
tangent
 
Posts: 201
Joined: Fri Mar 28, 2008 11:59 am

Re: Jaxer modifies a valid HTML input and making it invalid

Postby vanilla » Thu May 28, 2009 12:21 pm

Well the Spry comes with a amazing module for handling all types of data and translating it to a parse-able template system. This is one features what makes Spry one of peoples choice as default framework. No other JavaScript framework has nailed this type of widget with such finesse like Spry did.

Sure I can a none Jaxer template engine to parse out templates but than I might as well ditch Jaxer completely and build it all in PHP or Ruby. But I wanted to show case the ability of Spry client side and server side. This should also include the servers side data handling. Plugging Spry right in to the Jaxer.DB for example.

I tested with FireFox 3.0.10, FireFox night produces the same effect. What it does do is highlight the " />" end tags of my meta tags with a red color, but it does not change the source what so ever. If this was what you where referring to.

Anyways thanks for your advices on this matter once again.
Arnout Kazemier

Adobe Spry Community Expert

3rdEden | 3rd-Eden.com | Spry-it.com | config.Spry-it.com
Twitter: http://www.twitter.com/3rdEden | http://www.twitter.com/AdobeSpry
User avatar
vanilla
 
Posts: 16
Joined: Mon May 11, 2009 6:20 pm


Return to Jaxer Coding Q & A