Cross Browser Way of Taking Block Node Containing Text Into Child Window
My parent window has a button with the containing text "Show Help".
The help text is supposed to be presented in a child window.
The button runs a script that
- Retrieves a DOM node of a DIV element containing the help text, with the DIV element CSS property 'display:none;' set
- Opens up a child window
- Passes the DOM node to a function that has an argument for specifying the content of the body of the child Window
So I tried using approved methods---which does not include making use of the nonstandard properties outerHTML or innerHTML. I have been testing with FF17, IE9, and Chrome23 in Win7, FF17 in Ubuntu Linux, and IE8 in Win XP. In most cases, IE8 in WinXP is the problem.
I am using .importNode() and only "standardized" methods and properties (ECMA, W3C).
But there are aggravating problems. For example, importNode() works in Firefox, but when I scripted this in FF17 (Win7), it was reporting that childWin.document.body (namely, the body DOM node) was null! If I ran the script in the debugger, the body node was not null! The body node was being referenced in script after the document.close() call, which was itself subsequent to a number of document.write() calls. It was clear that the body node presence was time-dependent...and an onload event seemed to be necessary (why??). But when I write an onload event, it never triggered! These are the aggravations.
And then there is the problem of still writing the code to do the same for IE8 and IE7 earlier versions. Probably I will have to just pass a string made of HTML markup as the body, and use a document.write() call. Not good.
Has anyone else worked on this?