How do you validate (for example using http://validator.w3.org/) a multipage jquery mobile site? For example if I navigate away from index.html the page is only a div without a header or body.

有帮助吗?

解决方案

"It depends".

Validation only makes sense in the context of HTML documents, and if you are modifying a document with JavaScript you only have the initial state to validate.

You could use a tool such as Selenium to drive the site and take snapshots of the DOM (serialising it to HTML) when it is in different states, then validate those snapshots. (The markup validation series has an API you can call programatically so you could combine those).

If you are generating fragments of HTML on the server (instead of sending pure, structured data to the client) then you can embed those fragments in HTML skeleton documents and validate those. You should have such documents existing for most views anyway (since you don't want to repeat Gawker's mistake by having a fragile site completely dependant on Ajax).

See also Progressive Enhancement and Unobtrusive JavaScript

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top