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
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 ?
Each page needs a test case like this:
If you put “Strict XHTML” into your DOCTYPE, then tidy should enforce
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” ]’
command, and parses the XHTML inside it. The do-end block sees that
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
target wildly forgiving browsers, and even though our production code
away with sloppy HTML. We do this because enforcing XHTML makes all our
tests much easier to write.