Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7303

Re: validating AJAX

Message-ID <2995978.SPkdTlGXAF@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2011-10-12 20:26 +0200
Subject Re: validating AJAX
Newsgroups comp.lang.javascript
References <qOednag60LmwXg_TnZ2dnUVZ_rKdnZ2d@cablespeedmi.com> <1d5b97pqn9173n4bt8o09hfdrsqd14ge8g@hive.bjoern.hoehrmann.de> <8913453.SEqChMirdb@PointedEars.de> <rqcb9752adme6612hgdh2u55mkmn5fpbgb@hive.bjoern.hoehrmann.de>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Bjoern Hoehrmann wrote:

> * Thomas 'PointedEars' Lahn wrote in comp.lang.javascript:
>>Bjoern Hoehrmann wrote:
>>> I made a couple of proof-of-concept client-side validators that operate
>>> on the browser in-memory DOM tree rather than on serialized markup, see
>> Is that a wise course of action, given that layout engines would
>> sometimes build a DOM tree that does not fit the markup when presented
>> with invalid markup?  For example, I have seen element objects for block
>> elements being moved to be the previous sibling of an inline element
>> object when the invalid markup said it would be a child element of the
>> respective inline element instead.
> 
> It would depend on your needs, if you already have an in-memory tree and
> manipulate it, it's much wiser to operate on the tree directly to check
> it for errors than serializing the tree and parsing the serialized form
> again to re-create the same tree. If you only have some markup then you
> would miss errors in the markup if you only look at the in-memory tree
> after recovering from all errors that can only be seen while parsing. If
> you are working with XML this would not be an issue as the XML parser
> will report all notable errors, usually by stopping the parser, so when
> you obtain the tree at all, you know there are no notable errors at that
> level.

I fail to see the logic in this.  If you already have an "in-memory" 
(document) tree, there either is no guarantee that it fits the markup it is 
being created from or there is not a good chance of it being invalid in that 
sense (as a conforming implementation would not allow inserting elements 
where they are not allowed – which can be easily confirmed).  What you could 
detect this way is elements having attributes that they should not have, or 
attributes that have values that they should not have.  But there is no 
guarantee for the detection of errors there as well, as it all hinges on the 
behavior of the DOM implementation, and it is very far from being sufficient 
when compared to markup validation.


PointedEars
-- 
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

Back to comp.lang.javascript | Previous | NextPrevious in thread | Find similar


Thread

validating AJAX bill <nobody@spamcop.net> - 2011-10-10 06:04 -0400
  Re: validating AJAX "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-10 10:09 -0700
    Re: validating AJAX bill <nobody@spamcop.net> - 2011-10-11 06:34 -0400
      Re: validating AJAX Tim Streater <timstreater@greenbee.net> - 2011-10-11 12:01 +0100
        Re: validating AJAX bill <nobody@spamcop.net> - 2011-10-12 06:37 -0400
          Re: validating AJAX Tim Streater <timstreater@greenbee.net> - 2011-10-12 12:24 +0100
            Re: validating AJAX Donkey Hottie <donkey@fredriksson.dy.fi> - 2011-10-12 14:36 +0300
          Re: validating AJAX Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-10-12 13:45 +0200
            Re: validating AJAX Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 14:36 +0200
            Re: validating AJAX bill <nobody@spamcop.net> - 2011-10-13 06:17 -0400
      Re: validating AJAX "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-11 05:54 -0700
  Re: validating AJAX Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2011-10-12 15:29 +0200
    Re: validating AJAX Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 16:19 +0200
      Re: validating AJAX Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2011-10-12 17:40 +0200
        Re: validating AJAX Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 20:26 +0200

csiph-web