PDA

View Full Version : Validate after DOM manipulation


bacterozoid
10-14-2009, 08:44 PM
Are there any proper methods of validating my code after using AJAX to modify the source code of my web page?

Problem 1: View Source always views the original rendered source, not any new stuff.

Problem 2: Using extensions or "View Selection Source" in Firefox to see the generated source code does not work. Sure I can see the source, but it's all generated and it messes the code up by removing the doctype and unclosing self-closed tags like <br/>. This creates errors.

Ignoring errors isn't a great option, because if I actually forget a self-closing tag or forget to add a doctype, I would never know.

I've looked for a while and haven't found anything, but maybe somebody has another technique?

Thanks!

ohgod
10-14-2009, 10:08 PM
go get firebug for firefox.

oesxyl
10-14-2009, 10:19 PM
go get firebug for firefox.
as far as I know firebug don't check if page is valid or not. More then that it add a lot of generated code to the page you see and sometime it make it invalid.

maybe "a lot" is to much, :)
Are there any proper methods of validating my code after using AJAX to modify the source code of my web page?

Problem 1: View Source always views the original rendered source, not any new stuff.

Problem 2: Using extensions or "View Selection Source" in Firefox to see the generated source code does not work. Sure I can see the source, but it's all generated and it messes the code up by removing the doctype and unclosing self-closed tags like <br/>. This creates errors.

Ignoring errors isn't a great option, because if I actually forget a self-closing tag or forget to add a doctype, I would never know.

I've looked for a while and haven't found anything, but maybe somebody has another technique?

Thanks!
web developer extension have a "view generated source" you can use it and save the code from that window with "save code as". I don't like this but I don't know other method and this seems to work.

best regards

bacterozoid
10-15-2009, 12:23 AM
Firebug actually adds and modifies code. For example, it adds the <tbody> tag and I believe it forces <br> to <br/>. There's also no easy way to copy the entire page code from it.

The "View Generated Source" methods don't output the code I put in. Like I said, it removes the doctype and the ending "/" from self-closing tags like <br/> because it generates all of the code.

I don't know that there are any "true" methods of getting the exact source you put in. Maybe there's a reason for this? I'm sure if there wasn't somebody would have fixed it already. I'm curious to know why none of the methods out there give you the right code...