PDA

View Full Version : Ext.History iframe doesn't validate w3c strict



had
14 Aug 2008, 7:18 AM
Hello,

The piece of code that had to be added doesn't validate with the w3c since iframe isn't xhtml strict. It was quite bothersome because since adding history I always had errors with the html validator plugin for firefox, and it makes it more difficult to debug your page. I circumvented the error by adding the following code in Ext.History.init()


var form = document.createElement("form");
form.setAttribute("id", "history-form");
form.setAttribute("class", "x-hidden");
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("id", "x-history-field");
form.appendChild(input);
var iframe = document.createElement("iframe");
iframe.setAttribute("id", "x-history-frame");
form.appendChild(iframe);
document.documentElement.firstChild.appendChild(form);
It works and no need to add the iframe to the html any more for history to work. The one call to Ext.History.init() sets everything up which is even cooler... B)

alloftheabove
14 Aug 2008, 11:51 AM
??

I haven't even tried any of the new components out. This code makes no sense to me! :)):)):)) Not intended to be mean or anything, it's just I haven't looked at that part of the code. So, naturally, I have no clue how it works.

Was it like you had to put the iframe in the html page code or something? Cause that definitely wouldn't validate. I hope that's what you meant. Otherwise I'm afraid I don't understand. Time for some coffee! ~o)~o)

dj
14 Aug 2008, 4:29 PM
Hi had,

AFAIK the form (and probably the iframe) have to be in the markup. Adding it dynamically does not work. The history thingy works because the browser populates the form/iframe on page load - before the JavaScript adds it. Firefox does not need the form/iframe - that's for other browsers (i.e. IE/Opera).

In short: Try your modifications in all browsers, you will probably notice that Ext.History does not work in some anymore.

Condor
15 Aug 2008, 12:35 AM
Any reason you want your site to be xhtml strict? Can't it just be xhtml frameset?

ps. File uploading also uses an IFRAME.