strict XHTML compliant ajax library

problem : i have to develope a app using ajax features and it has to run in an environment(web tv related) which is very strict about XHTML compliance.

and ajax codes generated by rails doesnt seem to be compliant. (they work on normal webpages , but not in the webtv env)

other than writing my own ajax codes and including them as helpers.

is there any other way ?

thanks

Lin Wj wrote:

problem : i have to develope a app using ajax features and it has to run in an environment(web tv related) which is very strict about XHTML compliance.

and ajax codes generated by rails doesnt seem to be compliant. (they work on normal webpages , but not in the webtv env)

other than writing my own ajax codes and including them as helpers.

is there any other way ?

Install my assert_xpath, and activate its assert_javascript.

(This currently uses Javascript-PurePerl, and I hope to upgrade that to a Ruby solution shortly.)

Each page needs a test case like this:

   def test_foo_is_tidy      get :foo      assert_tidy    end

If you put "Strict XHTML" into your DOCTYPE, then tidy should enforce that.

Next, to test an Ajax call, you would do this:

   xhr :get, :xhr_change_the_frob    assert_js_replace_html :frob do      assert_xpath :'form/input[ @name = "baz" and @value = "42" ]'    end

assert_js_replace_html lexes the returned JavaScript, finds the Element.update() command, and parses the XHTML inside it. The do-end block sees that XHTML, so you can do further queries on it.

All these tests will fail if the XHTML has a single ill-formed tag.

At my day-job, we enforce strict "Transitional XHTML", even though we only target wildly forgiving browsers, and even though our production code could get away with sloppy HTML. We do this because enforcing XHTML makes all our view tests much easier to write.